This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/70196] inconsistent constness of inequality of weak symbol addresses


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
          ^
$

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]