http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58597
Bug ID: 58597 Summary: [c++11] ICE with lambda in default argument of template function Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: reichelt at gcc dot gnu.org The following valid code snippet (compiled with "-std=c++11") triggers an ICE since GCC 4.5.0 (when lambdas were introduced): =============================================================== template<typename> struct A { template<typename T> A(T, int = []{ return 0; }()) {} }; A<int> a = 0; =============================================================== bug.cc: In substitution of 'template<class T> A< <template-parameter-1-1> >::A(T, int) [with T = int]': bug.cc:6:12: required from here bug.cc:6:12: internal compiler error: in instantiate_template_1, at cp/pt.c:15008 A<int> a = 0; ^ 0x5d0b93 instantiate_template_1 ../../gcc/gcc/cp/pt.c:15008 0x5d0b93 instantiate_template(tree_node*, tree_node*, int) ../../gcc/gcc/cp/pt.c:15117 0x5d264a fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node* const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool) ../../gcc/gcc/cp/pt.c:15466 0x53f0fc add_template_candidate_real ../../gcc/gcc/cp/call.c:2923 0x53ae69 add_template_candidate ../../gcc/gcc/cp/call.c:3020 0x53ae69 add_candidates ../../gcc/gcc/cp/call.c:5075 0x53bd40 build_user_type_conversion_1 ../../gcc/gcc/cp/call.c:3484 0x546013 build_user_type_conversion(tree_node*, tree_node*, int, int) ../../gcc/gcc/cp/call.c:3653 0x6843da ocp_convert(tree_node*, tree_node*, int, int, int) ../../gcc/gcc/cp/cvt.c:865 0x6913dd expand_default_init ../../gcc/gcc/cp/init.c:1597 0x6913dd expand_aggr_init_1 ../../gcc/gcc/cp/init.c:1766 0x693b79 build_aggr_init(tree_node*, tree_node*, int, int) ../../gcc/gcc/cp/init.c:1517 0x557da5 build_aggr_init_full_exprs ../../gcc/gcc/cp/decl.c:5543 0x557da5 check_initializer ../../gcc/gcc/cp/decl.c:5678 0x56aa5c cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ../../gcc/gcc/cp/decl.c:6347 0x65196f cp_parser_init_declarator ../../gcc/gcc/cp/parser.c:16567 0x65207f cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:10986 0x653ee0 cp_parser_block_declaration ../../gcc/gcc/cp/parser.c:10867 0x65cf1e cp_parser_declaration ../../gcc/gcc/cp/parser.c:10764 0x65bc8a cp_parser_declaration_seq_opt ../../gcc/gcc/cp/parser.c:10650 Please submit a full bug report, [etc.]