[PATCH] Fix PR16537 - Ensure the TR1 definition of POD is used for layout, regardless of LangOpts

Josh Magee Joshua_Magee at playstation.sony.com
Thu Jul 18 11:44:44 PDT 2013


Hello,

This is a fix for PR16537.  As described in the bug, the TR1 definition of POD
should be used for the purposes of layout even when in C++11 mode.  However,
when determining if a structure is PlainOldData  (i.e., when calculating
data().PlainOldData in lib/AST/DeclCXX.cpp) the method isPODType() is called
and isPODType() will call either isCXX98PODType() or isCXX11PODType depending
on LangOpts.  The effect of this is that when compiling in C++11 mode,
sometimes the TR1 definition of POD will be used and in other cases the C++11
definition of POD will be used.

The attached patch explicitly calls isCXX98PodType() which I believe is the
right thing to do.  (Note, isCXX98PodType() calls isPOD(), which just queries
data().plainOldLayout, which means that PlainOldData should not be dependent on
the LangOpts otherwise isCXX98PodType() will not always return the correct
result when compiling in C++11 mode.)

This issue introduced a C++ ABI difference between 3.1 and 3.2 which affected
how tail padding was re-used when compiling in C++11 mode.  The proposed patch
would fix the ABI, but this means there would be an ABI difference between 3.3
and 3.4.  I think a change like this would warrant a mention in the release
notes.  Should I include a patch that updates the release notes?  What is the
procedure in this type of situation?

Thanks,
Josh

http://llvm-reviews.chandlerc.com/D1181

Files:
  lib/AST/DeclCXX.cpp
  test/SemaCXX/class-layout.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1181.1.patch
Type: text/x-patch
Size: 8792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130718/ab3886c8/attachment.bin>


More information about the cfe-commits mailing list