[PATCH] D110485: Support [[no_unique_address]] for all targets.

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 9 12:51:35 PST 2022

mstorsjo added a comment.

In D110485#3308854 <https://reviews.llvm.org/D110485#3308854>, @mstorsjo wrote:

> To pick up the thread here again, `[[no_unique_address]]` is done and settled in MSVC, with the slightly surprising semantics: `[[no_unique_address]]` is accepted, without any warning (in C++20 mode), but it has no effect. (This, not related to LLVM, but because they had shipped it in earlier versions without having an effect, and changing that later would break things.) `[[msvc::no_unique_address]]` does have an effect though. See https://github.com/microsoft/STL/issues/1364#issuecomment-1034167093 for a more authoritative source on that.
> So, separately from implementing `[[msvc::no_unique_address]]`, I think we also should also silence the current warning about unknown attribute for the standard `[[no_unique_address]]`, to match MSVC.

Oh, also, according to https://devblogs.microsoft.com/cppblog/msvc-cpp20-and-the-std-cpp20-switch/, the plan is to change `[[no_unique_address]]` to actually have an effect the next time the compiler breaks its C++ ABI at an unknown point in the future. (This shouldn't be an issue for Clang, as we'd have to make a conscious effort to implement the new ABI whenever that happens anyway.)



More information about the cfe-commits mailing list