https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85135
Bug ID: 85135 Summary: [7/8 Regression] ICE with invalid late-specified return type 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 invalid code snippet (compiled with "-std=c++1z") triggers an ICE since GCC 7.1.0: ==================================== template<int> struct A {}; auto foo() -> A; template<typename> struct B {}; auto foo() -> A; ==================================== bug.cc:7:15: internal compiler error: canonical types differ for identical types A and A auto foo() -> A; ^ 0x75c440 comptypes(tree_node*, tree_node*, int) ../../gcc-7.1.0/gcc/cp/typeck.c:1433 0x6229a8 decls_match(tree_node*, tree_node*) ../../gcc-7.1.0/gcc/cp/decl.c:1085 0x6232fc duplicate_decls(tree_node*, tree_node*, bool) ../../gcc-7.1.0/gcc/cp/decl.c:1409 0x810ee8 pushdecl_maybe_friend_1 ../../gcc-7.1.0/gcc/cp/name-lookup.c:835 0x810ee8 pushdecl_maybe_friend(tree_node*, bool) ../../gcc-7.1.0/gcc/cp/name-lookup.c:1352 0x639635 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int, tree_node*, tree_node*, tree_node**) ../../gcc-7.1.0/gcc/cp/decl.c:5137 0x722a07 cp_parser_init_declarator ../../gcc-7.1.0/gcc/cp/parser.c:19255 0x74718c cp_parser_simple_declaration ../../gcc-7.1.0/gcc/cp/parser.c:12777 0x747f25 cp_parser_block_declaration ../../gcc-7.1.0/gcc/cp/parser.c:12602 0x74d3d4 cp_parser_declaration ../../gcc-7.1.0/gcc/cp/parser.c:12500 0x74f00b cp_parser_declaration_seq_opt ../../gcc-7.1.0/gcc/cp/parser.c:12376 0x74f2ea cp_parser_translation_unit ../../gcc-7.1.0/gcc/cp/parser.c:4366 0x74f2ea c_parse_file() ../../gcc-7.1.0/gcc/cp/parser.c:38431 0x8b25e3 c_common_parse_file() ../../gcc-7.1.0/gcc/c-family/c-opts.c:1107 Please submit a full bug report, [etc.]