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

            Bug ID: 124516
           Summary: ICE: tree check: expected tree that contains ‘decl
                    minimal’ structure, have ‘template_id_expr’ in
                    dump_decl, at cp/error.cc:1636
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: suyuchang at whu dot edu.cn
  Target Milestone: ---

Code:
template <typename a, union a ::a < class a ::a <

Command:
g++ -c test.cpp

Output:
tree check: expected tree that contains ‘decl minimal’ structure, have
‘template_id_expr’ in dump_decl, at cp/error.cc:1636
0x2cb8d8e internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:787
0xad0ac6 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        ../../gcc-trunk/gcc/tree.cc:9393
0x884ae0 contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
        ../../gcc-trunk/gcc/tree.h:3926
0x884ae0 dump_decl
        ../../gcc-trunk/gcc/cp/error.cc:1636
0xd4f64b decl_to_string
        ../../gcc-trunk/gcc/cp/error.cc:3569
0xd4f64b cp_printer
        ../../gcc-trunk/gcc/cp/error.cc:4893
0x2d3998b format_phase_2
        ../../gcc-trunk/gcc/pretty-print.cc:2303
0x2d3998b pretty_printer::format(text_info&)
        ../../gcc-trunk/gcc/pretty-print.cc:1846
0x2cc6b5e pp_format(pretty_printer*, text_info*)
        ../../gcc-trunk/gcc/pretty-print.h:599
0x2cc6b5e
diagnostics::context::report_diagnostic(diagnostics::diagnostic_info*)
        ../../gcc-trunk/gcc/diagnostics/context.cc:1530
0x2cc7044 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ../../gcc-trunk/gcc/diagnostics/context.cc:1689
0x2cbba49 error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:614
0xcf786f check_elaborated_type_specifier(tag_types, tree_node*, bool)
        ../../gcc-trunk/gcc/cp/decl.cc:18145
0xe6ace4 cp_parser_elaborated_type_specifier
        ../../gcc-trunk/gcc/cp/parser.cc:23460
0xe3a2a6 cp_parser_type_specifier
        ../../gcc-trunk/gcc/cp/parser.cc:22372
0xe5b700 cp_parser_decl_specifier_seq
        ../../gcc-trunk/gcc/cp/parser.cc:18843
0xe4f2c6 cp_parser_parameter_declaration
        ../../gcc-trunk/gcc/cp/parser.cc:28451
0xe5125b cp_parser_template_parameter
        ../../gcc-trunk/gcc/cp/parser.cc:20827
0xe5125b cp_parser_template_parameter_list
        ../../gcc-trunk/gcc/cp/parser.cc:20511
0xe6f975 cp_parser_explicit_template_declaration
        ../../gcc-trunk/gcc/cp/parser.cc:36316
/home/syc/gcc-16.0/libexec/gcc/x86_64-pc-linux-gnu/16.0.1/cc1plus -quiet
-imultiarch x86_64-linux-gnu -D_GNU_SOURCE test.cpp -quiet -dumpdir a-
-dumpbase test.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -o
/tmp/ccv72zAn.s

Goes back to GCC 12.1

The test case was generated by a fuzzer.

Reply via email to