<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/90407>90407</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[ABI] Type with potentially-overlapping member (`[[no_unique_address]]`) still considered POD for the purpose of layout
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
MitalAshok
</td>
</tr>
</table>
<pre>
https://itanium-cxx-abi.github.io/cxx-abi/abi.html#POD
> However, a type is not considered to be a POD for the purpose of layout if it is:
> - [...]
> - a POD-struct with one or more potentially-overlapping non-static data members.
Clang does not seem to respect this. This is visible when tail-padding is not reused
https://github.com/llvm/llvm-project/blob/216787cffc4a864e0effb165c1c32b92328a0a06/clang/lib/AST/RecordLayoutBuilder.cpp#L2421
```c++
struct X { // Not POD for the purpose of layout
[[no_unique_address]] alignas(4) char a; // potentially-overlapping
};
struct Y : X {
char b; // This should be in the tail-padding
};
static_assert(sizeof(Y) == 4);
```
Clang makes `sizeof(Y) == 8`, disagreeing with GCC
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVM1u4zYQfhr6MrAgDyVZPuhgR1VbYNtdtDl0TwEpjix2KVElqWTTpy9IexsHbQIsQEgAifk43w9HeK_PM1HDyhMr241Yw2hd84sOwhz9aL9spFXPzRjC4hk_MuwYdjqIWa_Ttv_6dSukzs46jKvMtGXYXfcYdvFkDJNhyD99bFnesvx4_fIf4Cf7RI_kGN6BgPC8EGgPsw3Q29lrRY4UBAuSQMCnjy0M1kEYCZbVLdYT2AGMeLZrAD2ADqBTe__CwxZYecqyjJXtq92EtvXBrX2AJx1GsDOBdTBZR7DYQHPQwpjnrX0kZ8Sy6PkMs523Poige1AiCJhokuR8dsvqzoj5DMrShYcnmiIDR36hPkAYtc_gftQ-Mn3UXktD8DTSDEFos12EUvGqqwyOVk_qFv-1B1fNezsx7Ix5_PbbLs7-SX1g2EljJcMOd9W-3vfD0BeirgrKaRjkrir7Xc9RHpBjLXKRV9G8SCEC6Vh4_P2eYfcb9dapD0nr06qNIpf1y8KQf8ACd698rfLL6hme4kq7V63_ALY_AVy6h19teN_WSy0AQErmabYP66z_WulBKOXI-2hs2YIw-jwLz7AuGB6gH4UDwfjLTW9Yeu143zJ-uuVw7fYzMH689PzSSQKXt-DJTj_a1agYVT0nMrd-vn1PTNOD8J5cYFh7_TfZgWH9OdJgvGW8hUjppe6buv8N3SS-kAdW5f-LUscavAOlvTg7opiylPwf7-42quHqwA9iQ81uvys4VhUWm7HZ1VyVkotdsR-k5GXNq4OsKl7VWHA8qI1uMMciL7De7csciwwLsS8l7_OhyMWQl6zIaRLaZDGWmXXnjfZ-peaQF_l-Y4Qk49PYQZzpCdIhQ4xTyDUpynI9e1bkRvvgX1CCDibNq-Pp55iA-zg8Ep-3Xu_ltQLDpMR7cUpKHcAHbcztJHo3qpvVmea7X2fi6xl2SY9_AgAA___nt7SD">