https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120696
Bug ID: 120696 Summary: ICE: tree check: accessed elt 2 of 'tree_vec' with 1 elts in tsubst, at cp/pt.cc:16758 Product: gcc Version: 16.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rush102333 at gmail dot com Target Milestone: --- $cat test_75.cpp namespace Deduction { template <typename T> struct X0; template <typename T> class X0<T>; template <typename T, unsigned N> struct X0<T __attribute__((matrix_type(N, 3)))> { static const unsigned value = 0; }; typedef int __attribute__((matrix_type(2, 3))) int2; int array0[X0<int2>::value == 0 ? 1 : -1]; } $g++ -fsyntax-only test_75.cpp <source>:5:7: error: partial specialization 'class Deduction::X0<T>' does not specialize any template arguments; to define the primary template, remove the template argument list 5 | class X0<T>; | ^~~~~ <source>:3:8: note: primary template here 3 | struct X0; | ^~ <source>:8:46: warning: ignoring attributes applied to dependent type 'T' without an associated declaration [-Wattributes] 8 | struct X0<T __attribute__((matrix_type(N, 3)))> { | ^ <source>:12:48: warning: 'matrix_type' attribute directive ignored [-Wattributes] 12 | typedef int __attribute__((matrix_type(2, 3))) int2; | ^~~~ <source>: In instantiation of 'struct Deduction::X0<int>': <source>:14:20: required from here 14 | int array0[X0<int2>::value == 0 ? 1 : -1]; | ^~ <source>:8:49: internal compiler error: tree check: accessed elt 2 of 'tree_vec' with 1 elts in tsubst, at cp/pt.cc:16758 8 | struct X0<T __attribute__((matrix_type(N, 3)))> { | ^ 0x2835bc5 diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag (*) [1], diagnostic_t) ???:0 0x2857356 internal_error(char const*, ...) ???:0 0x9edccf tree_vec_elt_check_failed(int, int, char const*, int, char const*) ???:0 0xb5fa96 tree_vec_elt_check(tree_node*, int, char const*, int, char const*) ???:0 0xd3ce34 tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0xd573b9 tsubst_template_args(tree_node*, tree_node*, int, tree_node*) ???:0 0xd3bdeb tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0xd3c8a4 tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0xd6af19 instantiate_class_template(tree_node*) ???:0 0xd06cb3 c_parse_file() ???:0 0xe6e799 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. Please see https://godbolt.org/z/7E5jYnKxK