https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98803
Bug ID: 98803 Summary: [C++20] ICE on invalid code with checked build [in synthesize_implicit_template_parm, at cp/parser.c:45335] Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dimitri.gorokhovik at free dot fr Target Milestone: --- Not sure whether ICEs from tree-check choking on error_mark should be submitted, but here is: template <typename> concept Defined = true; template <auto, auto> struct entry {}; template <Defined auto d, Undefined auto u> constexpr auto matches (entry <d, u>, Atom auto b) { return d == b; }; compiling with 'g++ -std=c++20' from 11.0.0 20210123 produces: bug-12.cpp:6:27: error: ‘Undefined’ has not been declared 6 | template <Defined auto d, Undefined auto u> | ^~~~~~~~~ bug-12.cpp:6:27: error: two or more data types in declaration of ‘u’ bug-12.cpp:7:35: error: ‘u’ was not declared in this scope 7 | constexpr auto matches (entry <d, u>, Atom auto b) { return d == b; }; | ^ bug-12.cpp:7:36: error: template argument 2 is invalid 7 | constexpr auto matches (entry <d, u>, Atom auto b) { return d == b; }; | ^ bug-12.cpp:7:39: error: ‘Atom’ has not been declared 7 | constexpr auto matches (entry <d, u>, Atom auto b) { return d == b; }; | ^~~~ bug-12.cpp:7:49: internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘error_mark’ in synthesize_implicit_template_parm, at cp/parser.c:45335 7 | constexpr auto matches (entry <d, u>, Atom auto b) { return d == b; }; | ^ 0x837a8f tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*) ../../src/gcc/tree.c:9986 0x6b0fa0 contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*) ../../src/gcc/tree.h:3452 0x6b0fa0 synthesize_implicit_template_parm ../../src/gcc/cp/parser.c:45335 0xa94bad cp_parser_simple_type_specifier ../../src/gcc/cp/parser.c:18648 0xa7332d cp_parser_type_specifier ../../src/gcc/cp/parser.c:18457 0xa74329 cp_parser_decl_specifier_seq ../../src/gcc/cp/parser.c:15003 0xa8efce cp_parser_parameter_declaration ../../src/gcc/cp/parser.c:23693 0xa8f9a2 cp_parser_parameter_declaration_list ../../src/gcc/cp/parser.c:23510 0xa8fdf1 cp_parser_parameter_declaration_clause ../../src/gcc/cp/parser.c:23437 0xa80f33 cp_parser_direct_declarator ../../src/gcc/cp/parser.c:22086 0xa80f33 cp_parser_declarator ../../src/gcc/cp/parser.c:21949 0xa97f98 cp_parser_init_declarator ../../src/gcc/cp/parser.c:21447 0xa9edab cp_parser_single_declaration ../../src/gcc/cp/parser.c:30432 0xa9ef16 cp_parser_template_declaration_after_parameters ../../src/gcc/cp/parser.c:30004 0xa9f6c0 cp_parser_explicit_template_declaration ../../src/gcc/cp/parser.c:30270 0xaa1e09 cp_parser_declaration ../../src/gcc/cp/parser.c:14009 0xaa27ec cp_parser_toplevel_declaration ../../src/gcc/cp/parser.c:14107 0xaa27ec cp_parser_translation_unit ../../src/gcc/cp/parser.c:4936 0xaa27ec c_parse_file() ../../src/gcc/cp/parser.c:45170 0xbc538d c_common_parse_file() ../../src/gcc/c-family/c-opts.c:1211 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.