https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89745
Bug ID: 89745 Summary: [[no_unique_address]] has no effect in some cases Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: tower120 at gmail dot com Target Milestone: --- [[no_unique_address]] has no effect in the following case: https://wandbox.org/permlink/pcMbjWGcdKL3aHJS template<class F, class S> struct alternative_pair{ [[no_unique_address]] F first; [[no_unique_address]] S second; }; int main(){ struct empty{}; using Data = void*; using P1 = alternative_pair<Data, empty>; using P2 = alternative_pair<P1, empty>; std::cout << sizeof(Data) << std::endl; std::cout << sizeof(P1) << std::endl; std::cout << sizeof(P2) << std::endl; return 0; } Output: 8 8 16 Expected: 8 8 8