<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/104227>104227</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang crashed when used [[no_unique_address]].
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Adttil
</td>
</tr>
</table>
<pre>
See on godbolt : [https://gcc.godbolt.org/z/68ET15Thn](https://gcc.godbolt.org/z/68ET15Thn)
This simple code make clang crashed. It seems to be related to `[[no_unique_address]]`.
Removing `[[no_unique_address]]` from `wrapper` or adding `[[no_unique_address]]` to `foo` as stated in the comments will result in successful compilation.
```cpp
#include <type_traits>
#include <utility>
struct E{};
struct wrapper{
[[no_unique_address]] // delete this
E value{};
};
struct foo{
//[[no_unique_address]] // or add this
wrapper value{};
constexpr auto fn()const{
return 0;
}
};
int main(){
auto a = foo{}.fn();
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVF2PqzYQ_TXmZXQRmADhgYfkkkh9bfd9ZewhuDU2tcfZbn99BUk2zWp3tVdCIHs-zjnDzIgQ9Mkitqzcs7JLRKTR-XaniLRJeqde2z8QwVk4OdU7Q8CKHbByPxLNgRU7xo-MH09SpleH1PkT48d_GT9W28NTXj6NlpUd49tfC-ENyzqW7Z5GHSDoaTYI0imESfyFII2wJ5BehBFVCr8RBMQpADnoETwaQaiWE6uyVdreuudo9d8Rn4VSHkNYSJUdq7IUAC5Yv-PkztqevhMFg3fT4vjixTyjX66cB6HUdxNc2A3OLQcRINBKWlugcdE6TWgpwIs2BjyGaGixhSglhjBEs7jM2gjSzqY3CQvw-sh5vt7wQltpokJgxU96nfGZvNAUWHH4yCOSNppe79b1HchHSXBg9Z7VHSv2HxhvlaivRlgK-1UV4NIKoNAgIdCowz3yAGdhIr4H_Ax8qeMD8Jr6W_CX3_YO_irmYxJvXtLZQPjP7EFEcjBYxreMN-v1nY5Hit5C9pZgJVh3n0nSlmAS-prsQdYKI4AV3U1x3aU32IcqPbbD5ZiotlBN0YgE27zmRVWVvMiTsS0KmQ9Dj6Kpa4Wqqsoqy2SzrapKqGxTJLrlGd9k23yTN2VR5mnTb1Req7IeZM6HbGCbDCehTWrMeVomOtEhRGzzbMN5nRjRownrmuF8nV7G-bJxfLsE_OjjKbBNZnSgcE9Bmgy2P_8_7PAyooUYUH3dW2kSvWnf7RxNY-xT6SbGjwvI9fNj9u5PlMT4cSUdGD9eeZ9b_l8AAAD__0P4hr0">