https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84520
Bug ID: 84520 Summary: [6/7/8 Regression] ICE with lambda and static member function Product: gcc Version: 8.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: reichelt at gcc dot gnu.org Target Milestone: --- The following valid testcase triggers an ICE since GCC 5.1.0. It was compiled without problems in GCC 4.9.x. ================================================ struct A { static void foo(int); void (*f)(int) = [](auto i) { foo(i); }; }; ================================================ bug.cc: In instantiation of 'A::<lambda(auto:1)> [with auto:1 = int]': bug.cc:4:29: required by substitution of 'template<class auto:1> A::<lambda(auto:1)>::operator decltype (((A::<lambda(auto:1)>)0u).operator()(i)) (*)(auto:1)() const [with auto:1 = int]' bug.cc:4:41: required from here bug.cc:4:36: internal compiler error: in lambda_expr_this_capture, at cp/lambda.c:697 void (*f)(int) = [](auto i) { foo(i); }; ^ 0x83f04c lambda_expr_this_capture(tree_node*, bool) ../../gcc-5.1.0/gcc/cp/lambda.c:695 0x83f387 maybe_resolve_dummy(tree_node*, bool) ../../gcc-5.1.0/gcc/cp/lambda.c:789 0x6485a1 build_new_method_call_1 ../../gcc-5.1.0/gcc/cp/call.c:8027 0x6485a1 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, tree_node*, int, tree_node**, int) ../../gcc-5.1.0/gcc/cp/call.c:8275 0x7cd9ef finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ../../gcc-5.1.0/gcc/cp/semantics.c:2367 0x6b536f tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc-5.1.0/gcc/cp/pt.c:15211 0x6a2a85 tsubst_expr ../../gcc-5.1.0/gcc/cp/pt.c:14398 0x6a39b2 tsubst_expr ../../gcc-5.1.0/gcc/cp/pt.c:13809 0x6a25fb tsubst_expr ../../gcc-5.1.0/gcc/cp/pt.c:13981 0x6a25fb tsubst_expr ../../gcc-5.1.0/gcc/cp/pt.c:13981 0x6a0774 instantiate_decl(tree_node*, int, bool) ../../gcc-5.1.0/gcc/cp/pt.c:20407 0x7219f8 mark_used(tree_node*, int) ../../gcc-5.1.0/gcc/cp/decl2.c:5029 0x63d88a build_over_call ../../gcc-5.1.0/gcc/cp/call.c:7489 0x64889e build_new_method_call_1 ../../gcc-5.1.0/gcc/cp/call.c:8205 0x64889e build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, tree_node*, int, tree_node**, int) ../../gcc-5.1.0/gcc/cp/call.c:8275 0x6b5fe2 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc-5.1.0/gcc/cp/pt.c:15205 0x6aac9e tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc-5.1.0/gcc/cp/pt.c:12530 0x6b0a5f tsubst_function_type ../../gcc-5.1.0/gcc/cp/pt.c:11624 0x6ab365 tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc-5.1.0/gcc/cp/pt.c:12357 0x6aac06 tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc-5.1.0/gcc/cp/pt.c:11899 Please submit a full bug report, [etc.]