[PATCH] D117616: GCC ABI Compatibility: Preserve alignment of non-pod members in packed structs

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 25 18:42:45 PST 2022


rjmccall added a comment.

> In addition to the ABI compatibility concern, IMO, GCC's behavior here is better and more user friendly:
>
> - C++ classes have methods
> - calling a method on a field takes the address of a field

I mean, this argument is hardly limited to non-POD types.  I suppose you could argue that with trivially-copyable types, you could at least copy the object somewhere else before calling the method.  But then the condition ought to be "has a trivial, non-deleted copy/move constructor" rather than "POD for the purposes of the ABI."

Well, anyway, as always, GCC is entitled to set the ABI for the platforms on which it is the system compiler.  I assume the POD definition actually comes from C++03 and not C++98, in which IIRC member pointers were non-trivial.  Darwin will opt out, yes, and I think we should assume that PS4 will as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117616/new/

https://reviews.llvm.org/D117616



More information about the cfe-commits mailing list