<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/59000>59000</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
regression on main with packed pod types (POD type detection fails, sizeof packed types is bigger)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
adrianimboden
</td>
</tr>
</table>
<pre>
https://godbolt.org/z/xnPc7bxMY
```
#include <type_traits>
#include <cstdint>
class Foo {
public:
constexpr explicit Foo(int64_t v) : value_{v} {
}
int get_value(){
return value_;
}
constexpr explicit Foo() = default;
private:
int64_t value_;
};
static_assert(std::is_trivial<Foo>::value);
static_assert(std::is_standard_layout<Foo>::value);
static_assert(std::is_pod<Foo>::value);
struct __attribute__((packed)) Bar {
uint8_t a;
Foo member;
};
static_assert(sizeof(Bar) == 9);
Bar b{.a=1, .member=Foo{4}};
```
I did not do a bisect, but on clang 15, it behaves correctly.
- type traits say Foo is a POD type (I think that is correct)
- the warning says that Foo is not a POD type
- packing does not pack because compiler actually thinks it is not a POD type (sizeof is bigger)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyllMFy2jAQhp_GXDRhjI0NPvgAoZnJodNce_JI1mLUCMsjrUjI03dlGwiBtod6hLC00rf_7koWRh7LHWLnonQVJU_UGiOF0Tg1tqHRB_3e25d6Id6__4ziTRSvxj6PxzYMk1S1tfYSWJQ-4rGDCi1XSNxv91bUDqVq8WLt-1pz59iTMSxarIepzgut6qCuHzJ6atM6hPfOMurIqDBsiZIlAfN5hewQJQU5WbED1x4qYh2ixebCZONzGZH5s44wRTDWAFY9g-DEvAFYQG_bk5t0fQd47eeP0gfFGyZhy73GM-tz31l14AhXuTiHfC0huL-HcMhR1RVlGSySW6pCwKUr5ahe6qC4puIESVSY3jCGX5xxf0OQrZXcykrzo_H4P6jOyH9tP0Gsr5FVFUeKQHiEquoTuux4_Qoy7KDkrrm9PgCeUrekzPGruoWzt4e9AHs3lzeK1QeYLb0QfixhqGJxKzP4FyRgSv42syh5ZNOTn02IcrGeB0ef6_blhvX9M5NKstYgk4ZxJpSDGgONAmemZXSD2obNsjBFh0vAjh_A0bmzlhbq43TAPLBwRdlwRZnjxz5w5Qj58mMzGCmqZ4Y71b5SzzFYR0yI7oTZAXvjtlXklTBuWDrCgswL8LQllCUslwaGJWGClNbcOyAX-05psIzX6LnWx0GCC9HcINm5BMEmVNNAKMMEylmeL7M4y-N4IstUFmnBJ6hQQ2mhseCcomRR23PVsjeFOzacFkbnrke7wD77kYAUd9iz5Uq7kN3R77ht2HIlwlv99dNKfryYUog00Ppw-nvorPnV5_VJOeeB-E9ZEZP2XSlIuqzzNMsKPs9nMqvrdC4SmYhiu5TpbKK5AO3KKFtHSdLCG-sR9B5lm4kqkzhJZrNZFhfzfB5PY8jTdCFhUcvFcptDNI-BcqCnQUf45k9s2UsSvnFk1Mqhuxjp4KumBejdEZ973BlbcmkVb9VeGAntpBdQ9gH8BmD-6iA">