[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, "");
  static_assert(sizeof(t2) == 12, "");

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?

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list