[cfe-commits] [PATCH] Implement member pointer support for the MS ABI in Sema

John McCall rjmccall at apple.com
Sun Aug 15 20:24:21 PDT 2010


On Aug 15, 2010, at 7:45 PM, Charles Davis wrote:

> On 8/15/10 8:17 PM, John McCall wrote:
>> 
>> On Aug 15, 2010, at 6:58 PM, Eli Friedman wrote:
>> 
>>> On Sun, Aug 15, 2010 at 6:16 PM, Charles Davis <cdavis at mymail.mines.edu> wrote:
>>>> On 8/15/10 12:34 AM, Eli Friedman wrote:
>>>>> It would be nice to add the appropriate warning about constructing a
>>>>> member pointer to an incomplete type along with this... otherwise we
>>>>> can end up silently generating bad code.
>>>> It would be, but I don't know how to issue a diagnostic from the AST
>>>> library, so I've left that out for now.
>>> 
>>> Erm, I was thinking more along the lines of tossing a call to
>>> RequireCompleteType into Sema::BuildMemberPointerType in SemaType.cpp
>>> if we're using the MS ABI.  That should be a separate patch, though...
>> 
>> We definitely need a RequireCompleteType here in MS mode — if nothing
>> else, to force instantiation.  MSVC does permit the base to be an incomplete
>> type (falling back to the maximally general 8-byte representation), so if we want
>> to be perfectly compatible we'll eventually need to pass an empty PDiag.  For
>> now, though, we should probably just forbid it so that we can audit use cases
>> instead of silently compiling them differently from MSVC.  Hopefully it's not being
>> used in system headers.
> I see now.
> 
> On Aug 15, 2010, at 6:58 PM, Eli Friedman wrote:
>> Also, I think some extra checks in TryReinterpretCast in
>> SemaCXXCast.cpp are necessary; we shouldn't allow reinterpret_casting
>> between member pointers of different sizes.
> That sounds reasonable.
> 
> But this is all for a separate patch. Is this one OK to commit?

Yeah, I think this is fine.

John.



More information about the cfe-commits mailing list