This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/70196] inconsistent constness of inequality of weak symbol addresses
- From: "egallager at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 28 Aug 2017 14:36:26 +0000
- Subject: [Bug c++/70196] inconsistent constness of inequality of weak symbol addresses
- Auto-submitted: auto-generated
- References: <bug-70196-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70196
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-08-28
CC| |egallager at gcc dot gnu.org
Ever confirmed|0 |1
Known to fail| |8.0
--- Comment #2 from Eric Gallager <egallager at gcc dot gnu.org> ---
Combined into a single testcase and confirmed:
$ cat 70196.cc && /usr/local/bin/g++ -c -S -Wall -Wextra -Wpedantic -xc++
70196.cc
extern __attribute__ ((weak)) int i;
constexpr int *p = 0;
constexpr int *q = &i;
static_assert (p == q, "p == q");
static_assert (!(q < p), "!(a < p)"); // accepted and true
static_assert (p <= q, "p <= q"); // accepted and true
template <bool> struct S { };
S<!(&i < 0)> s0; // accepted
S<&i == 0> s1; // rejected
70196.cc:6:1: error: non-constant condition for static assertion
static_assert (p == q, "p == q");
^~~~~~~~~~~~~
70196.cc:6:18: error: ‘((& i) == 0)’ is not a constant expression
static_assert (p == q, "p == q");
~~^~~~
70196.cc:12:10: warning: ordered comparison of pointer with integer zero
[-Wextra]
S<!(&i < 0)> s0; // accepted
^
70196.cc:13:10: error: template argument 1 is invalid
S<&i == 0> s1; // rejected
^
$