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

2022-01-06 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85428

Patrick Palka  changed:

   What|Removed |Added

   Target Milestone|--- |12.0
 Status|NEW |RESOLVED
 Resolution|--- |FIXED
 CC||ppalka at gcc dot gnu.org

--- Comment #6 from Patrick Palka  ---
(In reply to Andrew Pinski from comment #4)
> (In reply to Barry Revzin from comment #1)
> > Also rejected as non-constant comparison.
> 
> That is a different issue and was fixed for GCC 10.3.0 and GCC 11+.

By r11-7176 FWIW

The other testcases are basically PR94716, and are accepted by GCC 12 since
r12-6188

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

2021-12-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85428

--- Comment #5 from Andrew Pinski  ---
For the first testcase, here is a reduced testcase:

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

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

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

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

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

2021-12-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85428

--- Comment #4 from Andrew Pinski  ---
(In reply to Barry Revzin from comment #1)
> Also rejected as non-constant comparison.

That is a different issue and was fixed for GCC 10.3.0 and GCC 11+.

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

2021-12-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85428

Andrew Pinski  changed:

   What|Removed |Added

 CC||jorg.brown at gmail dot com

--- Comment #3 from Andrew Pinski  ---
*** Bug 91693 has been marked as a duplicate of this bug. ***

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

2021-11-23 Thread fchelnokov at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85428

Fedor Chelnokov  changed:

   What|Removed |Added

 CC||fchelnokov at gmail dot com

--- Comment #2 from Fedor Chelnokov  ---
Here is an example without templates that erroneously fails to compile as well:
```
int main() {
static constexpr int x = 1;
static constexpr int y = 2;
static_assert(  !=  );
}
```
Demo: https://gcc.godbolt.org/z/3WdqP49Gq

Related discussion: https://stackoverflow.com/q/70091821/7325599

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

2021-01-31 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85428

Barry Revzin  changed:

   What|Removed |Added

 CC||barry.revzin at gmail dot com

--- Comment #1 from Barry Revzin  ---
Here's a different, C++20-specific test case:

constexpr bool f() {
int* a = new int;
int* b = new int;
bool result = (a == b);
delete a;
delete b;
return result;
}

static_assert(!f());

Also rejected as non-constant comparison.

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

2018-04-17 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85428

Jonathan Wakely  changed:

   What|Removed |Added

   Keywords||rejects-valid
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-04-17
 Ever confirmed|0   |1