https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68530

            Bug ID: 68530
           Summary: [C++14] sorry, unimplemented: unexpected AST of kind
                    loop_expr
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lucdanton at free dot fr
  Target Milestone: ---

Possibly related to PR c++/68206, which could also be exhibiting both this and
a potentially unrelated ICE.

$ g++-trunk --version
g++-trunk (GCC) 6.0.0 20151125 (experimental)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cat main.cpp  
struct thing {
    void foo() {}
};

template<typename>
constexpr int count()
{
    auto item = thing {};
    for(; (item.foo(), false););
    return 0;
}

int main()
{
    static_assert( count<int>() == 0, "" );
}
$ g++-trunk -std=c++14 main.cpp
main.cpp: In function 'int main()':
main.cpp:15:5: error: non-constant condition for static assertion
     static_assert( count<int>() == 0, "" );
     ^~~~~~~~~~~~~

main.cpp:15:30: error: 'constexpr int count() [with <template-parameter-1-1> =
int]' called in a constant expression
     static_assert( count<int>() == 0, "" );
                              ^

main.cpp:6:15: note: 'constexpr int count() [with <template-parameter-1-1> =
int]' is not usable as a constexpr function because:
 constexpr int count()
               ^~~~~

main.cpp:6:15: sorry, unimplemented: unexpected AST of kind loop_expr
main.cpp:6: confused by earlier errors, bailing out

Reply via email to