https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87521
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The meaning of "user-declared" in C++03 is closer to "has a function body" than
the meaning in C++11, where it includes defaulted definitions.
A defaulted definition in C++11 is equivalent to an implicit (i.e. not
user-declared) definition in C++03. So I would argue that your type is a POD
for the purposes of layout, and GCC is correct.
Consider:
struct Base {
unsigned x;
short y;
#if __cplusplus >= 201103L
~Base() = default;
#endif
};
struct Der : Base {
short z;
};
int i[] = { sizeof(Base), sizeof(Der) };
I would argue that the #if block should not affect the ABI of this type, i.e.
it should be identical in C++03 and C++11, so it should be a "POD for the
purposes of layout". Otherwise adding explicitly-defaulted special members (to
conform to guidance like the Rule of Zero) causes ABI changes.