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

            Bug ID: 126888
           Summary: ICE when explicitly specializing a template with
                    no_specializations attribute
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: s.kimura.h41104 at gmail dot com
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/nsGbMMrv5

Reproducer:
```
template <typename T>
struct __attribute__((no_specializations(__vector_size__(16)))) S {};

template <> struct S<long> {};
```

Backtrace:
<source>:2:42: error: there are no arguments to '__vector_size__' that depend
on a template parameter, so a declaration of '__vector_size__' must be
available [-fpermissive]
    2 | struct __attribute__((no_specializations(__vector_size__(16)))) S {};
      |                                          ^~~~~~~~~~~~~~~
<source>:2:42: note: (if you use '-fpermissive', G++ will accept your code, but
allowing the use of an undeclared name is deprecated)
<source>:4:20: internal compiler error: tree check: expected string_cst, have
call_expr in maybe_diagnose_no_specializations, at cp/pt.cc:1061
    4 | template <> struct S<long> {};
      |                    ^~~~~~~
0x2bc0f98 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x2bb5bdb internal_error(char const*, ...)
        ???:0
0xa3d2a0 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ???:0
0xdef96c maybe_process_partial_specialization(tree_node*)
        ???:0
0xd9b343 c_parse_file()
        ???:0
0xf2e8b9 c_common_parse_file()
        ???:0


This is trunk only:
https://godbolt.org/z/TTT4caM59

Reply via email to