[Bug c++/94716] comparison of address of template variables should be constexpr

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

Patrick Palka  changed:

   What|Removed |Added

 CC||pdimov at gmail dot com

--- Comment #7 from Patrick Palka  ---
*** Bug 86354 has been marked as a duplicate of this bug. ***

[Bug c++/94716] comparison of address of template variables should be constexpr

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

Patrick Palka  changed:

   What|Removed |Added

 CC||sjeltsch at gmail dot com

--- Comment #6 from Patrick Palka  ---
*** Bug 101622 has been marked as a duplicate of this bug. ***

[Bug c++/94716] comparison of address of template variables should be constexpr

2022-01-03 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94716

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:91031bffa42fdea3c985727d042cd1882a64be9c

commit r12-6188-g91031bffa42fdea3c985727d042cd1882a64be9c
Author: Jakub Jelinek 
Date:   Mon Jan 3 13:47:53 2022 +0100

symtab: Fold  ==  to 0 if folding_initializer [PR94716]

On Thu, Dec 09, 2021 at 06:09:12PM -0500, Jason Merrill wrote:
> For the more general comparison of decls like your a != b example above I
> think clang is in the right; in manifestly constant-evaluated context
> (folding_initializer) we should return that they are unequal and prevent
a
> later alias declaration, like we do for comparison to 0 in
> maybe_nonzero_address.  It's possible that this gives a wrong answer
based
> on something in another translation unit, but that's unlikely, and taking
> that chance seems better than rejecting code that needs a constant
answer.

I agree.  This is an incremental patch to do that.

2022-01-03  Jakub Jelinek  

PR c++/94716
gcc/
* symtab.c: Include fold-const.h.
(symtab_node::equal_address_to): If folding_initializer is true,
handle it like memory_accessed.  Simplify.
gcc/testsuite/
* gcc.dg/init-compare-1.c: New test.
* g++.dg/cpp0x/constexpr-compare1.C: New test.
* g++.dg/cpp1y/constexpr-94716.C: New test.
* g++.dg/cpp1z/constexpr-compare1.C: New test.

[Bug c++/94716] comparison of address of template variables should be constexpr

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

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|NEW |RESOLVED

--- Comment #4 from Andrew Pinski  ---
Dup of bug 91693.

*** This bug has been marked as a duplicate of bug 91693 ***

[Bug c++/94716] comparison of address of template variables should be constexpr

2021-09-10 Thread johelegp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94716

Johel Ernesto Guerrero Peña  changed:

   What|Removed |Added

 CC||johelegp at gmail dot com

--- Comment #3 from Johel Ernesto Guerrero Peña  ---
*** Bug 102267 has been marked as a duplicate of this bug. ***

[Bug c++/94716] comparison of address of template variables should be constexpr

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

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=69681
Summary|comparison of address of|comparison of address of
   |variables should be |template variables should
   |constexpr   |be constexpr

--- Comment #2 from Andrew Pinski  ---
Reduced testcase:
template  char test_impl = 0;
static_assert(_impl<0> != _impl<1>, "should not be equal");