<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/143245>143245</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
MSVC Compatibility: [[msvc::no_unique_address]] doesn't work in a base class
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mingxwa
</td>
</tr>
</table>
<pre>
```cpp
struct A {};
struct B {
[[msvc::no_unique_address]] A val;
};
struct C : B {
char x;
};
static_assert(sizeof(C) == 1); // clang-cl thinks sizeof(C) is 2, while it should be 1
```
When the standard `[[no_unique_address]]` is used in regular mode, the memory layout of `C` is expected.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMks-OmzAQxp9muIw2MjYkcOBAEuXWU6X2uDL2BNw1OPWYZNOnr2BTRVVbqRIS0oznN3--TzO7fiJqoNxDecz0nIYQm9FN_ftNZ12w9wa24uMzlwuIllOcTcIWYbeH3RHUHkT7jO_XuGhxJe5HvhpQLah2Cq_z5L7P9KqtjcQM5RHKI7Z41f5B-RN3QFDtE4pm0BHf__ZcJ2deNTPFBLJi94PCGWR1AFkjqCOoI-Yga1B7RJAnkCc0Xk_9i_GYBje9Mf5e5BglyAPeBucJXUIewuwtdoT50vTXWT4G-DrQhGkg5KQnq6PFJbXe4B-bw1YsPWYmi27CSP3sdcQxWFraLqyRxhDv6PU9zAnDeWEeHnX0fiGTyG4y2yhbq1pn1OS7opbVtlJ1NjTqbGhrhbZWdJ3MK5ELralToijonOdd5hopZCm2YidqIVS9MbIrRLEzZaXzQpkKCkGjdn7j_XXchNhnjnmmJi-ULMrM6448r96RcqIbrlmQcrFSbJail27uGQrhHSd-YpJLnppPn78c8BDGi06uc96l-yL2_xrHBuIJ5C7hLcS35YQaO820yMqczdE3Q0oXXiir3r1Lw9xtTBhBnpZRHr-XSwzfyCSQp3UBBnl6bHht5M8AAAD__8Ja9Ao">