https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52981

--- Comment #9 from David Stone <david at doublewise dot net> ---
It might further be worth giving the "you can rearrange to save sapce" option
two warning levels. The highest level would warn for all cases where
rearranging can reduce size, and the lowest level would warn for all cases
where rearranging only the private data members can reduce size. This is a
potentially important point because rearranging public / protected data members
can affect the API of your type by changing how it interacts with structured
bindings, and, if it is also an aggregate, aggregate construction.

The important new consideration that has the potential for a third warning
option is the handling of empty types. It could be useful to have a warning
that alerts the user that marking a data member with [[no_unique_address]]
would reduce the size of their structure. A potential name for this is
-Wempty-data-member-wastes-space or -Wmissing-no-unique-address.

Cross posted to the equivalent clang bug report:
https://bugs.llvm.org/show_bug.cgi?id=22442#c5

Reply via email to