public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109518] New: invalid constexpr code is accepted
@ 2023-04-15  4:28 Darrell.Wright at gmail dot com
  2023-04-18  9:44 ` [Bug c++/109518] " redi at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: Darrell.Wright at gmail dot com @ 2023-04-15  4:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109518
           Summary: invalid constexpr code is accepted
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Darrell.Wright at gmail dot com
  Target Milestone: ---

The following invalid code is UB but accepted by gcc.  The life of x has not
started yet, https://eel.is/c++draft/basic.life#1.2 , but it is accessed.

constexpr void init(int & x) { x = 42; }

constexpr int foo() {
    int x = (init(x), x);
    return x;
}

static_assert( foo( ) == 42 );

https://gcc.godbolt.org/z/oGE51eMz4

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

* [Bug c++/109518] invalid constexpr code is accepted
  2023-04-15  4:28 [Bug c++/109518] New: invalid constexpr code is accepted Darrell.Wright at gmail dot com
@ 2023-04-18  9:44 ` redi at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2023-04-18  9:44 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-04-18
             Status|UNCONFIRMED                 |NEW

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

end of thread, other threads:[~2023-04-18  9:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-15  4:28 [Bug c++/109518] New: invalid constexpr code is accepted Darrell.Wright at gmail dot com
2023-04-18  9:44 ` [Bug c++/109518] " redi 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).