public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109975] New: error: '(((int*)(&<anonymous>.X::a)) != 0)' is not a constant expression
@ 2023-05-26  3:12 ed at catmur dot uk
  2023-05-26  3:14 ` [Bug c++/109975] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: ed at catmur dot uk @ 2023-05-26  3:12 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/109975] error: '(((int*)(&<anonymous>.X::a)) != 0)' is not a constant expression
  2023-05-26  3:12 [Bug c++/109975] New: error: '(((int*)(&<anonymous>.X::a)) != 0)' is not a constant expression ed at catmur dot uk
@ 2023-05-26  3:14 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-26  3:14 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 85944.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-26  3:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-26  3:12 [Bug c++/109975] New: error: '(((int*)(&<anonymous>.X::a)) != 0)' is not a constant expression ed at catmur dot uk
2023-05-26  3:14 ` [Bug c++/109975] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).