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

            Bug ID: 115078
           Summary: ICE with invalid partial specialization of
                    template<auto>
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 420 at zerberste dot es
  Target Milestone: ---

Consider the following code snippet:
```cpp
template <auto... V>
struct Proxy;            // 1

template <typename... Ts, Ts... Ptr>
struct Proxy<Ptr...> {}; // 2

struct Bare {
    int alt_0;
};
template struct Proxy<&Bare::alt_0>;
```
https://gcc.godbolt.org/z/46GEhfYGc

The partial specialization 2) is not more specialized than the primary template
1). Instead of emitting a helpful error, current versions of GCC crash with
><source>:5:8: internal compiler error: in unify, at cp/pt.cc:24728
>    5 | struct Proxy<Ptr...> {};
>      |        ^~~~~~~~~~~~~
>0x26861cc internal_error(char const*, ...)
>       ???:0
>0xa5aaaf fancy_abort(char const*, int, char const*)
>       ???:0
>0xcbc865 maybe_process_partial_specialization(tree_node*)
>       ???:0
>0xc634da c_parse_file()
>       ???:0
>0xdb8d09 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.
>Compiler returned: 1


The earliest version of GCC I was able to get to crash with this is GCC 7.2 in
C++17 mode.


This might be related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84822

Reply via email to