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

            Bug ID: 102267
           Summary: Can't compare pointers to instantiated variables
                    during constant evaluation
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
                CC: johelegp at gmail dot com
  Target Milestone: ---

This is specified at https://eel.is/c++draft/expr.eq#3. See
https://godbolt.org/z/n995WdYff.
```C++
template<auto> constexpr char v{};
template<> constexpr char v<2>{};
template<> constexpr char v<3>{};
static_assert(&v<0> != &v<1>);
static_assert(&v<2> != &v<3>);
```
```
<source>:4:21: error: non-constant condition for static assertion
    4 | static_assert(&v<0> != &v<1>);
      |               ~~~~~~^~~~~~~~
<source>:4:21: error: '((& v<0>) != (& v<1>))' is not a constant expression
Compiler returned: 1
```

Reply via email to