[PATCH] D119051: Extend the C++03 definition of POD to include defaulted functions
David Blaikie via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 11 15:17:22 PST 2022
dblaikie added a comment.
Thanks for chiming in!
In D119051#3315741 <https://reviews.llvm.org/D119051#3315741>, @rjmccall wrote:
> Changing the C++03 POD definition is going to be substantially ABI-breaking at this point. Any logic to change it needs to be platform-specific.
Even if it's only related to the use of "= default"? Hrm. Got some examples I could try out?
Ah, I guess here: https://godbolt.org/z/P6n9xKTnM
struct t1 {
int i;
char c;
t1() = default;
};
struct t2: t1 {
char c;
};
#ifdef __clang__
static_assert(sizeof(t2) == 8, "");
#else
static_assert(sizeof(t2) == 12, "");
#endif
Where would be the right place for the platform specific detection to happen then? Can the places I've proposed changing in DeclCXX.cpp be made target-specific there, or do we have to compute two different properties there and do the target-specific selection between them at some later point/in the record layout logic?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119051/new/
https://reviews.llvm.org/D119051
More information about the cfe-commits
mailing list