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

Johel Ernesto Guerrero Peña <johelegp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Can't compare pointers to   |Can't compare pointers to
                   |instantiated variables      |non-specialization
                   |during constant evaluation  |instantiated variables
                   |                            |during constant evaluation
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|DUPLICATE                   |---

--- Comment #2 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
More generally: https://godbolt.org/z/63qoWc1zv.
```C++
template<auto> struct x { static constexpr char v{}; };
template<> struct x<2> { static constexpr char v{}; };
template<> struct x<3> { static constexpr char v{}; };
static_assert(&x<0>::v != &x<1>::v);
static_assert(&x<2>::v != &x<3>::v);
```
```
<source>:4:24: error: non-constant condition for static assertion
    4 | static_assert(&x<0>::v != &x<1>::v);
      |               ~~~~~~~~~^~~~~~~~~~~
<source>:4:24: error: '((& x<0>::v) != (& x<1>::v))' is not a constant
expression
Compiler returned: 1
```

Reply via email to