<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Missing [[no_unique_address]] on Windows"
href="https://bugs.llvm.org/show_bug.cgi?id=50014">50014</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Missing [[no_unique_address]] on Windows
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++2a
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rob.klein.ikink@student.nhlstenden.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=24764" name="attach_24764" title="test.cpp: the source file that triggers the warning. log.txt: console output from compiling test.cpp.">attachment 24764</a> <a href="attachment.cgi?id=24764&action=edit" title="test.cpp: the source file that triggers the warning. log.txt: console output from compiling test.cpp.">[details]</a></span>
test.cpp: the source file that triggers the warning. log.txt: console output
from compiling test.cpp.
<a href="https://clang.llvm.org/cxx_status.html#cxx20">https://clang.llvm.org/cxx_status.html#cxx20</a> 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: <a href="https://godbolt.org/z/nfaf3KeP3">https://godbolt.org/z/nfaf3KeP3</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>