https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102201
Bug ID: 102201
Summary: Accepts invalid C++98 with nested class and sizeof of
outer's non-static field
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
struct outer {
struct inner {
inner() :x(sizeof(y)) { }
unsigned int x;
};
int y;
};
----- CUT ----
The above code is valid C++11 but invalid C++98 because the field y is
non-static.