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

            Bug ID: 109404
           Summary: tree check: expected identifier_node, have
                    template_id_expr in dump_decl, at cp/error.cc:1301
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

template<typename> struct iterator { };

struct fn
{
  template<typename T>
    static constexpr bool is_iter = false;
  template<typename CharT>
    static constexpr bool is_iter<iterator<CharT> = true;
};

There's a missing '>' before '= true' but any build with checking enabled gives
an ICE:

ice.cc:8:27: error: parse error in template argument list
    8 |     static constexpr bool is_iter<iterator<CharT> = true;
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'
tree check: expected identifier_node, have template_id_expr in dump_decl, at
cp/error.cc:1301
0x8974ca tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        /home/jwakely/src/gcc/gcc/gcc/tree.cc:8909
0x6fb65d tree_check(tree_node*, char const*, int, char const*, tree_code)
        /home/jwakely/src/gcc/gcc/gcc/tree.h:3530
0x6fb65d dump_decl
        /home/jwakely/src/gcc/gcc/gcc/cp/error.cc:1301
0xa4adb7 decl_to_string
        /home/jwakely/src/gcc/gcc/gcc/cp/error.cc:3307
0xa4adb7 cp_printer
        /home/jwakely/src/gcc/gcc/gcc/cp/error.cc:4481
0x220250f pp_format(pretty_printer*, text_info*)
        /home/jwakely/src/gcc/gcc/gcc/pretty-print.cc:1475
0x21e11c5 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
        /home/jwakely/src/gcc/gcc/gcc/diagnostic.cc:1579
0x21e18f4 diagnostic_impl
        /home/jwakely/src/gcc/gcc/gcc/diagnostic.cc:1743
0x21e223a error_at(unsigned int, char const*, ...)
        /home/jwakely/src/gcc/gcc/gcc/diagnostic.cc:2066
0xa1cca4 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
        /home/jwakely/src/gcc/gcc/gcc/cp/decl.cc:14413
0xa3a14e grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*,
bool, tree_node*, tree_node*)
        /home/jwakely/src/gcc/gcc/gcc/cp/decl2.cc:990
0xb22389 cp_parser_init_declarator
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.cc:23025
0xb2a2be cp_parser_single_declaration
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.cc:32512
0xb2a4e4 cp_parser_template_declaration_after_parameters
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.cc:32065
0xb2ad70 cp_parser_explicit_template_declaration
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.cc:32338
0xaf6bf5 cp_parser_member_specification_opt
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.cc:27149
0xaf6bf5 cp_parser_class_specifier
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.cc:26161
0xaf6bf5 cp_parser_type_specifier
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.cc:19491
0xaf8606 cp_parser_decl_specifier_seq
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.cc:16044
0xaf9634 cp_parser_simple_declaration
        /home/jwakely/src/gcc/gcc/gcc/cp/parser.cc:15263
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


This bug seems to have been present since constexpr variable templates were
implemented in r213641 (so not a regression).

Reply via email to