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
Author: jason Date: Tue Apr 19 18:49:54 2016 New Revision: 235217 URL: https://gcc.gnu.org/viewcvs?rev=235217&root=gcc&view=rev Log: PR c++/68206 - Fix constexpr diagnostics with loops. PR c++/68530 * constexpr.c (potential_constant_expression_1): Handle LOOP_EXPR and GOTO_EXPR. Added: trunk/gcc/testsuite/g++.dg/cpp1y/constexpr-loop5.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/constexpr.c
Author: jason Date: Fri Apr 22 15:39:03 2016 New Revision: 235369 URL: https://gcc.gnu.org/viewcvs?rev=235369&root=gcc&view=rev Log: PR c++/68206 - Fix constexpr diagnostics with loops. PR c++/68530 * constexpr.c (potential_constant_expression_1): Handle LOOP_EXPR and GOTO_EXPR. Added: branches/gcc-6-branch/gcc/testsuite/g++.dg/cpp1y/constexpr-loop5.C Modified: branches/gcc-6-branch/gcc/cp/ChangeLog branches/gcc-6-branch/gcc/cp/constexpr.c
I think we can close this as fixed.