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

Eli Friedman eli.friedman at gmail.com
Thu Jul 18 11:53:45 PDT 2013


On Thu, Jul 18, 2013 at 11:44 AM, Josh Magee
<Joshua_Magee at playstation.sony.com> wrote:
> 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?

It's probably worth adding a comment to the release notes, but not
anything beyond that.

If you're changing the test to use C++11, you might as well use the
real static_assert instead of the "SA" macro.

Otherwise, the patch looks fine.

-Eli



More information about the cfe-commits mailing list