Input (you gotta love this one!): template<int... a> struct b { int &&c; int d[] = [] { auto f(a); }; } const __attribute__((noinline(b<>()))); Output: $ xgcc -x c++ -S - <stdin>: In lambda function: <stdin>:4:23: internal compiler error: unexpected expression 'a' of kind template_parm_index 0xa3d06b cxx_eval_constant_expression /home/vegard/git/gcc/gcc/cp/constexpr.c:4767 0xa4e0da cxx_eval_outermost_constant_expr /home/vegard/git/gcc/gcc/cp/constexpr.c:4827 0xa5b966 maybe_constant_value(tree_node*, tree_node*) /home/vegard/git/gcc/gcc/cp/constexpr.c:5044 0xaba942 cp_fully_fold(tree_node*) /home/vegard/git/gcc/gcc/cp/cp-gimplify.c:2040 0x142d41f store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) /home/vegard/git/gcc/gcc/cp/typeck2.c:848 0xb48878 check_initializer /home/vegard/git/gcc/gcc/cp/decl.c:6430 0xbdcd8e cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) /home/vegard/git/gcc/gcc/cp/decl.c:7084 0x10cc38d tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/vegard/git/gcc/gcc/cp/pt.c:16331 0x10c0128 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/vegard/git/gcc/gcc/cp/pt.c:16464 0x10c0128 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/vegard/git/gcc/gcc/cp/pt.c:16464 0x11d483f tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*) /home/vegard/git/gcc/gcc/cp/pt.c:17203 0x10f7dcb tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/vegard/git/gcc/gcc/cp/pt.c:18486 0xd27a93 get_nsdmi(tree_node*, bool, int) /home/vegard/git/gcc/gcc/cp/init.c:581 0xdc6d74 walk_field_subobs /home/vegard/git/gcc/gcc/cp/method.c:1354 0xdd46a3 synthesized_method_walk /home/vegard/git/gcc/gcc/cp/method.c:1744 0xde62f2 get_defaulted_eh_spec(tree_node*, int) /home/vegard/git/gcc/gcc/cp/method.c:1776 0x11d647a maybe_instantiate_noexcept(tree_node*, int) /home/vegard/git/gcc/gcc/cp/pt.c:23088 0xc64811 mark_used(tree_node*, int) /home/vegard/git/gcc/gcc/cp/decl2.c:5229 0x921ac0 build_over_call /home/vegard/git/gcc/gcc/cp/call.c:7680 0x9346ff build_new_method_call_1 /home/vegard/git/gcc/gcc/cp/call.c:9285 $ xgcc --version xgcc (GCC) 8.0.1 20180301 (experimental) Built from git c435a9e730c6e8f10da09d58b4fc9aaeb401b0d5 (r258097). 7.3.0 seems to be fine with this. Test case was minimised by C-Reduce.
Confirmed. Started with r251433.
Before that we printed a boatload of errors: q.cc: In lambda function: q.cc:4:26: error: parameter packs not expanded with ‘...’: int d[] = [] { auto f(a); }; ^ q.cc:4:26: note: ‘a’ q.cc: At global scope: q.cc:5:33: error: array must be initialized with a brace-enclosed initializer } const __attribute__((noinline(b<>()))); ^~~~~ q.cc:5:33: error: use of deleted function ‘b<>::b()’ q.cc:2:8: error: array must be initialized with a brace-enclosed initializer struct b { ^ q.cc:2:8: note: ‘b<>::b()’ is implicitly deleted because the default definition would be ill-formed: q.cc:2:8: error: uninitialized reference member in ‘struct b<>’ q.cc:3:9: note: ‘int&& b<>::c’ should be initialized int &&c; ^ q.cc:5:3: error: ‘const’ can only be specified for objects and functions } const __attribute__((noinline(b<>()))); ^~~~~ q.cc:2:8: warning: attribute ignored in declaration of ‘struct b<a>’ [-Wattributes] struct b { ^ q.cc:2:8: note: attribute for ‘struct b<a>’ must follow the ‘struct’ keyword
I cannot reproduce the ICE w/ any released version of gcc, from 8.1.0 through the current trunk.
I tried out various versions of gcc trunk, from revision 269700 to 270600 and could see no ice. I'd be interested to find out what Marek did to reproduce it.
I can't seem to reproduce this anymore, I suppose it could be closed.
Fixed.