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

            Bug ID: 70248
           Summary: constexpr initialization with unspecified equality
                    expression accepted
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

Going down the list of valid core constant expressions in [expr.const], the
following example adopted from [expr.eq] should be diagnosed since it
illustrates "a relational (5.9) or equality (5.10) operator where the result is
unspecified" and thus not a valid core constant expression.  However, the
example is accepted without a diagnostic by all versions of GCC (and by my
development version of Clang).

$ cat t.c && /build/gcc-trunk-bootstrap/gcc/xgcc -B
/build/gcc-trunk-bootstrap/gcc -S -Wall -Wextra -Wpedantic -xc++ t.c
struct A {};
struct B : A { int x; };
struct C : A { int x; };
constexpr int A::*bx = (int(A::*))&B::x;
constexpr int A::*cx = (int(A::*))&C::x;
constexpr bool b1 = (bx == cx); // unspecified

Reply via email to