https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77375
Bug ID: 77375 Summary: constant object with mutable subobject allocated in read-only memory Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: Casey at Carter dot net Target Milestone: --- When run, this program results in a segmentation fault: struct Base { mutable int i; }; struct Derived : Base {}; const Derived foo{}; int main() { foo.i = 42; } Despite its mutable subobject, the compiler allocates foo in read-only memory.