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

            Bug ID: 120820
           Summary: ICE: tree check: expected template_parm_index, have
                    error_mark in template_parameter_pack_p, at
                    cp/pt.cc:3520
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rush102333 at gmail dot com
  Target Milestone: ---

Starts to bailing out since gcc-13.1: https://godbolt.org/z/Ycovoq3zv

Test Input:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

template <int>
class A
{
};

template <typename... B>
struct C
{
  template <typename B::unknown... args>
  using ret_type = A<args...>;
};

int main()
{
  C<int>::ret_type<1> a;
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Stack Dump:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

<source>: In function 'int main()':
<source>:9:36: error: 'int' is not a class, struct, or union type
    9 |   template <typename B::unknown... args>
      |                                    ^~~~
<source>:9:36: error: 'int' is not a class, struct, or union type
<source>:15:21: internal compiler error: tree check: expected
template_parm_index, have error_mark in template_parameter_pack_p, at
cp/pt.cc:3520
   15 |   C<int>::ret_type<1> a;
      |                     ^
0x28391e5 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x285bd76 internal_error(char const*, ...)
        ???:0
0x9f7772 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ???:0
0xd66e63 coerce_template_parms(tree_node*, tree_node*, tree_node*, int, bool)
        ???:0
0xd474ce lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int)
        ???:0
0xd94aac finish_template_type(tree_node*, tree_node*, int)
        ???:0
0xd134d3 c_parse_file()
        ???:0
0xe7b1e9 c_common_parse_file()
        ???:0
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.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to