Empty Member Optimization with C++20's `[[no_unique_address]]`

Open in Compiler Explorer

image

[[no_unique_address]] makes the empty subobject (of type EmptySubobject) potentially overlapping. It’s implementation-defined whether its size should be 0 (see https://en.cppreference.com/w/cpp/language/object, section size). Apparently, x64 MSVC v19.38 hasn’t implemented the optimization.