https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97285
Bug ID: 97285 Summary: Interaction between no_unique_address and has_unique_object_representations Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- >From StackOverflow (https://stackoverflow.com/q/64195712/2069064): #include <type_traits> struct Empty {}; struct A : public Empty { int x; }; struct B { [[no_unique_address]] Empty e; int x; }; static_assert (sizeof(A) == sizeof(int)); // ok static_assert (sizeof(B) == sizeof(int)); // ok static_assert(std::has_unique_object_representations_v<A>); // ok static_assert(std::has_unique_object_representations_v<B>); // error gcc does not consider B to have unique object representations, but it should here.