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

            Bug ID: 109975
           Summary: error: '(((int*)(&<anonymous>.X::a)) != 0)' is not a
                    constant expression
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ed at catmur dot uk
  Target Milestone: ---

struct X { int a[1]; };
constexpr bool b = (X{}.a != 0);

<source>:7:27: error: '(((int*)(&<anonymous>.X::a)) != 0)' is not a constant
expression
    7 | constexpr bool b = (X{}.a != 0);
      |                    ~~~~~~~^~~~~

AFAICT this does not fall foul of anything in [expr.const]. Other compilers
accept, with a tautological-compare warning in the case of clang.
Similar to bug 71962, but this happens without enabling sanitizer.

Reply via email to