https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84804
Bug ID: 84804 Summary: [8 Regression] ICE with lambda in default argument Product: gcc Version: 8.0 Status: UNCONFIRMED Keywords: ice-on-invalid-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 inavlid code snippet triggers an ICE on trunk: ================================================= template<int> struct A { friend void foo(int i = []{ return 0;}()) {} }; void bar() { A<0>::foo(); } ================================================= bug.cc: In instantiation of 'struct A<0>': bug.cc:8:7: required from here bug.cc:3:41: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in tsubst_lambda_expr, at cp/pt.c:17155 friend void foo(int i = []{ return 0;}()) {} ~~~~~~~~~~~~~~^~ 0x78b66e tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../gcc/gcc/tree.c:9385 0x639e0e tree_class_check(tree_node*, tree_code_class, char const*, int, char const*) ../../gcc/gcc/tree.h:3255 0x639e0e tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*) ../../gcc/gcc/cp/pt.c:17155 0x95f422 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc/gcc/cp/pt.c:18495 0x96036f tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc/gcc/cp/pt.c:17820 0x96dd9f tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc/gcc/cp/pt.c:17255 0x96dd9f tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc/gcc/cp/pt.c:16987 0x95c936 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc/gcc/cp/pt.c:16175 0x95c936 tsubst_default_argument(tree_node*, int, tree_node*, tree_node*, int) ../../gcc/gcc/cp/pt.c:12346 0x95e2e6 tsubst_default_arguments ../../gcc/gcc/cp/pt.c:12404 0x95e2e6 tsubst_function_decl ../../gcc/gcc/cp/pt.c:12651 0x979c56 tsubst_decl ../../gcc/gcc/cp/pt.c:12924 0x9740ef tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc/gcc/cp/pt.c:13812 0x98c962 tsubst_friend_function ../../gcc/gcc/cp/pt.c:9948 0x98c962 instantiate_class_template_1 ../../gcc/gcc/cp/pt.c:10989 0x98c962 instantiate_class_template(tree_node*) ../../gcc/gcc/cp/pt.c:11055 0x9d38fd complete_type(tree_node*) ../../gcc/gcc/cp/typeck.c:136 0x9321aa cp_parser_nested_name_specifier_opt ../../gcc/gcc/cp/parser.c:6445 0x933cb5 cp_parser_simple_type_specifier ../../gcc/gcc/cp/parser.c:17177 0x92de15 cp_parser_type_specifier ../../gcc/gcc/cp/parser.c:16850 Please submit a full bug report, [etc.] The regression was introduced between 2017-11-09 and 2017-11-17.