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