https://bugs.llvm.org/show_bug.cgi?id=50014
Bug ID: 50014
Summary: Missing [[no_unique_address]] on Windows
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: C++2a
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
Created attachment 24764
--> https://bugs.llvm.org/attachment.cgi?id=24764&action=edit
test.cpp: the source file that triggers the warning. log.txt: console output
from compiling test.cpp.
https://clang.llvm.org/cxx_status.html#cxx20 lists the [[no_unique_address]]
attribute as supported since Clang 9. However, the attribute does not seem to
currently be supported on Windows platforms.
Compiling the following source code on Windows with Clang 12.0.0 with
-std=c++20:
struct X {};
struct Y1 {
[[no_unique_address]] X x;
long long a;
};
struct Y2 {
X x;
long long a;
};
int main() {}
gives the following warning:
test.cpp:4:4: warning: unknown attribute 'no_unique_address' ignored
[-Wunknown-attributes]
[[no_unique_address]] X x;
^~~~~~~~~~~~~~~~~
1 warning generated.
The size of objects from Y1 are also the same size as those from Y2, indicating
that an unique address is indeed still generated:
std::cout << sizeof(Y1) << ", " << sizeof(Y2);
prints "16, 16" compared to "8, 16" on Linux: https://godbolt.org/z/nfaf3KeP3
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs