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

Eli Friedman eli.friedman at gmail.com
Sun Aug 15 18:58:21 PDT 2010


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...

And actually, it should probably be an error; I'm not sure that's
completely compatible with MSVC, but ensuring consistent IR generation
without it would be utterly nasty.  Also, I think it's better to
provide a consistent, non-compliant interpretation of the standard
instead of something which sort of seems like it might work, and which
could possibly be suppressed by the use of the C++ standard library.

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.

-Eli



More information about the cfe-commits mailing list