http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59111
Bug ID: 59111 Summary: [4.9 Regression] [c++11] ICE on invalid usage of auto in return type 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 invalid code snippet (compiled with "-std=c++11") triggers an ICE on trunk: ===================== auto& foo(); int i = foo(); ===================== bug.cc:1:11: warning: 'foo' function uses 'auto' type specifier without trailing return type [enabled by default] auto& foo(); ^ bug.cc:3:13: internal compiler error: tree check: expected record_type or union_type or qual_union_type, have template_type_parm in lookup_conversions, at cp/search.c:2509 int i = foo(); ^ 0xd3a614 tree_check_failed(tree_node const*, char const*, int, char const*, ...) ../../gcc/gcc/tree.c:9166 0x6bd9f7 tree_check3 ../../gcc/gcc/tree.h:2746 0x6bd9f7 lookup_conversions(tree_node*) ../../gcc/gcc/cp/search.c:2509 0x5493a6 build_user_type_conversion_1 ../../gcc/gcc/cp/call.c:3447 0x54a3c1 implicit_conversion ../../gcc/gcc/cp/call.c:1756 0x54ff6c can_convert_arg_bad(tree_node*, tree_node*, tree_node*, int, int) ../../gcc/gcc/cp/call.c:8960 0x677940 convert_for_assignment ../../gcc/gcc/cp/typeck.c:7992 0x5eff71 digest_init_r ../../gcc/gcc/cp/typeck2.c:1009 0x5f1dc2 digest_init_flags ../../gcc/gcc/cp/typeck2.c:1078 0x5f1dc2 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ../../gcc/gcc/cp/typeck2.c:766 0x566066 check_initializer ../../gcc/gcc/cp/decl.c:5739 0x57909d cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ../../gcc/gcc/cp/decl.c:6358 0x666c11 cp_parser_init_declarator ../../gcc/gcc/cp/parser.c:16727 0x66837f cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:11118 0x64c7b0 cp_parser_block_declaration ../../gcc/gcc/cp/parser.c:10999 0x670477 cp_parser_declaration ../../gcc/gcc/cp/parser.c:10896 0x66f198 cp_parser_declaration_seq_opt ../../gcc/gcc/cp/parser.c:10782 0x670a3a cp_parser_translation_unit ../../gcc/gcc/cp/parser.c:4010 0x670a3a c_parse_file() ../../gcc/gcc/cp/parser.c:31187 0x791cd3 c_common_parse_file() ../../gcc/gcc/c-family/c-opts.c:1055 Please submit a full bug report, [etc.]