[PATCH] [ms-cxxabi] Correctly compute the size of member pointers

Reid Kleckner rnk at google.com
Thu Mar 28 11:39:08 PDT 2013


On Thu, Mar 28, 2013 at 11:00 AM, John McCall <rjmccall at apple.com> wrote:

> On Mar 27, 2013, at 6:38 PM, Reid Kleckner <rnk at google.com> wrote:
> >    - Split function member pointer case from data case.
> >
> > Hi rjmccall,
> >
> > http://llvm-reviews.chandlerc.com/D568
> >
> > CHANGE SINCE LAST DIFF
> >  http://llvm-reviews.chandlerc.com/D568?vs=1406&id=1416#toc
>
> +        RD->addAttr(::new (Context) UnspecifiedInheritanceAttr(
> +            RD->getSourceRange(), Context));
>
> For sanity's sake, you need to add this to all the declarations.  RD here
> is likely to be only the first redeclaration, so I suspect you'll get this
> wrong
> if you have:
>
>   struct A; // this will get the UnspecifiedInheritanceAttr
>   struct A; // but this won't
>   int A::*mptr = 0; // this should have size 12
>   struct A { // this becomes the RD in the type but has failed to inherit
> the attribute
>     int x, y, z;
>   };
>   int A::*mptr2 = 0; // this should have size 12, but probably has size 4
>

OK, I thought I had this case tested, but adding the extra redecl does what
you suspected.  Fixed by iterating the redecls.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130328/f9c0c30c/attachment.html>


More information about the cfe-commits mailing list