https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80145

            Bug ID: 80145
           Summary: [c++1y] ICE after failed return type deduction
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: error-recovery, 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 invalid code snippet (compiled with -std=c++1y)
triggers an ICE since GCC 4.8.0:

================================
auto* foo() { return 0; }
auto* foo();
================================

bug.cc: In function 'auto* foo()':
bug.cc:1:22: error: unable to deduce 'auto*' from '0'
 auto* foo() { return 0; }
                      ^
bug.cc:1:22: note:   mismatched types 'auto*' and 'int'
bug.cc: At global scope:
bug.cc:2:11: internal compiler error: in merge_types, at cp/typeck.c:768
 auto* foo();
           ^
0x75ae68 merge_types(tree_node*, tree_node*)
        ../../gcc/gcc/cp/typeck.c:768
0x75a2e5 merge_types(tree_node*, tree_node*)
        ../../gcc/gcc/cp/typeck.c:835
0x6236e8 duplicate_decls(tree_node*, tree_node*, bool)
        ../../gcc/gcc/cp/decl.c:2144
0x808108 pushdecl_maybe_friend_1
        ../../gcc/gcc/cp/name-lookup.c:835
0x808108 pushdecl_maybe_friend(tree_node*, bool)
        ../../gcc/gcc/cp/name-lookup.c:1352
0x6379c5 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ../../gcc/gcc/cp/decl.c:5137
0x71c477 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:19251
0x740a9c cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:12773
0x741835 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:12598
0x746c44 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:12496
0x74886b cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:12372
0x748b4a cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4366
0x748b4a c_parse_file()
        ../../gcc/gcc/cp/parser.c:38423
0x8a8ec3 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1107
Please submit a full bug report, [etc.]

Reply via email to