Open Quuxplusone opened 3 years ago
Attached attachments.zip
(683 bytes, application/x-zip-compressed): test.cpp: the source file that triggers the warning. log.txt: console output from compiling test.cpp.
_Bug 51051 has been marked as a duplicate of this bug._
This is not a bug. Microsoft has not defined the ABI for this attribute on their platform, so Clang needs to wait for Microsoft to define that before we can support [[no_unique_address]] there (otherwise we run into potential ABI incompatibilities).
However, I'm leaving this request open because presumably Microsoft will define the ABI on their platform for this feature, and then Clang can follow suit.
(In reply to Aaron Ballman from comment #2)
> This is not a bug. Microsoft has not defined the ABI for this attribute on
> their platform, so Clang needs to wait for Microsoft to define that before
> we can support [[no_unique_address]] there (otherwise we run into potential
> ABI incompatibilities).
>
> However, I'm leaving this request open because presumably Microsoft will
> define the ABI on their platform for this feature, and then Clang can follow
> suit.
Microsoft already added support for this as of VS 2019 16.9.
(https://docs.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance?view=msvc-160)
(In reply to Rob Klein Ikink from comment #3)
> (In reply to Aaron Ballman from comment #2)
> > This is not a bug. Microsoft has not defined the ABI for this attribute on
> > their platform, so Clang needs to wait for Microsoft to define that before
> > we can support [[no_unique_address]] there (otherwise we run into potential
> > ABI incompatibilities).
> >
> > However, I'm leaving this request open because presumably Microsoft will
> > define the ABI on their platform for this feature, and then Clang can follow
> > suit.
>
> Microsoft already added support for this as of VS 2019 16.9.
> (https://docs.microsoft.com/en-us/cpp/overview/visual-cpp-language-
> conformance?view=msvc-160)
Alas, but I don't believe the documentation based on how their compiler behaves
in practice (which is not something Clang will be emulating because it looks to
be a buggy implementation). See https://godbolt.org/z/j1PzbK68P, but basically,
__has_cpp_attribute returns false for both no_unique_address and
msvc::no_unique_address, yet the latter actually does the correct thing that
the former is standardized to do while the former is silently ignored.
It is not intended that MSVC predefines __has_cpp_attribute(msvc::no_unique_address)
to 0
. (Copy-pasta strikes again!) I'll get it changed to 201803L
. It is intentional that MSVC predefines __has_cpp_attribute(no_unique_address)
to 0
, however - we don't consider the no-op implementation to be worthy of claiming support for the attribute.
As an STL developer, I would greatly appreciate if clang-cl were to implement [[msvc::no_unique_address]]
. I'm willing to bribe people with adult beverages =)
attachments.zip
(683 bytes, application/x-zip-compressed)