<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/59624>59624</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`std::is_trivially_copyable_v` is `false` using clang for class with const class field.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
chriselrod
</td>
</tr>
</table>
<pre>
https://godbolt.org/z/oEE5scYb8
^ Shows `static_assert` failure with clang, but not gcc or msvc. Code for reference:
```c++
#include <type_traits>
#include <utility>
#include <cstdint>
#include <cstddef>
struct Foo{
size_t x{0};
};
struct CFoo{
const size_t x{0};
};
struct Bar{
const Foo y;
};
static_assert(std::is_trivially_copyable_v<Foo>); # pass
static_assert(std::is_trivially_copyable_v<CFoo>); # pass
static_assert(std::is_trivially_copyable_v<Bar>); # error for clang, pass for gcc
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysU11vozoQ_TXDi9UIbAjNAw9NGv7AfbpPkT8G8JWDI8-Q3vTXryBJt626u9rVSlYCMz7Hx4c5msj3I2ID1Raq50xPPMTU2CF5wpCiy0x0l2ZgPhGoJ5AtyLaPzsTAq5h6kO0ryDbu9xXZf80j5M-QP0G1F_8M8YUErHNizd4eNBEmhnUuOu3DlFC8eB6EDXrsQe6EmViMkUVvrYhJHOlsV2IXHYouJpGww4SjxVnE9Yx1fl0W5HZe16pUfrRhcihA7fhywgMn7ZlA7b_aMbEPni8_6Fpi50f-Sddh99YlTpNl0cYI9U2OIP-KBxb_Q73NoX4Gddf57vmG230ACiFsHIl_h2Gr0xcEbYzi8iXsDn7_feQjsZtNVk-eDpz82esQLgcbTxdtAh7OoBalag9yA2orQCpx0kR_zPaX6WYXPrBhSjEtU_Q2bPMBS6W39tM4Za5RbqM2OsOmWNdFVZelVNnQOJnbTplNicZKV5jOFY-m7DqlnMzrwmS-kbmUhVx-ValWRbVxpepMYRDLQtdQ5njUPqxCOB_n9GSeaMKm2qxlmQVtMNA9iKmZNz2YqSco8-CJ6TuMPQdslmz9wo51LvySwk4Hwvl1Ij_2VyfunhDdsrjMy7XQeQxulU0pfA6_52EyKxuPINtZ0e3v4ZTif2gZZLvcikC2y8W-BQAA__8OaFr1">