https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117651
Bug ID: 117651
Summary: Read of an uninitialized subobject not detected in
constant expression
Product: gcc
Version: 14.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: fchelnokov at gmail dot com
Target Milestone: ---
This program
```
struct B {
int v;
};
constexpr B g() { B b; return b; }
static_assert( g().v == 0 );
```
must fail because v-subobject is not initialized, and it does so in Clang and
MSVC. Unfortunately, GCC accepts the program just fine. Online demo:
https://gcc.godbolt.org/z/5Kbqxjrej