https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90285
--- Comment #2 from Niall Douglas <s_gccbugzilla at nedprod dot com> --- To put this into a wider context, the detach and attach cast proposal passed muster earlier this week at the WG14 meeting that I am currently sitting in. The current C2x draft allows this implementation of "unidirectional reinterpret casting with no aliasing of input with output" under its "effective type" object model. (I will be taking this proposal to WG21 in July. Its paper number will be P1631 "Object detachment and attachment") The ability to specify a non-aliasing reinterpret cast is valuable. If you shrink the size of the Foo object e.g. https://godbolt.org/z/a1Fajj, GCC generates ideal codegen. So I suspect the cause of this issue is probably quite easy to fix. Niall