https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105795
Bug ID: 105795 Summary: Miscompilation with [[no_unique_address]] Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: git at foonathan dot net Target Milestone: --- The following code should return 1: ``` struct empty {}; template <typename T> struct tuple_holder { [[no_unique_address]] T value; }; struct tuple : tuple_holder<int>, tuple_holder<empty> {}; constexpr auto make_tuple(int&& i, empty&& e) { return tuple{i, e}; } int main() { auto tuple = make_tuple(1, empty{}); return static_cast<const tuple_holder<int>&>(tuple).value; } ``` This is also the case with clang and GCC 11.1. However, starting with GCC 11.2, the code returns 0 instead: https://godbolt.org/z/Gb6Kffnnc