[Bug c++/85428] constexpr pointer equality comparison not considered constant expression

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Dec 28 10:53:40 GMT 2021


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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
For the first testcase, here is a reduced testcase:

template <int> char hh= 0;
static_assert(&hh<0> != &hh<1>, "should not be equal");

----- CUT ----
Note the above is even valid C++14.

And here is the reduced valid C++11 testcase:
template <int> struct a
{
    static const char hh= 0;
};

static_assert(&a<0>::hh!=&a<1>::hh, "");


More information about the Gcc-bugs mailing list