[cfe-dev] Objective-C and C++0x nullptr

Chris Lattner clattner at apple.com
Mon May 30 12:51:53 PDT 2011


On May 30, 2011, at 4:45 AM, Sebastian Redl wrote:

>> When compiling this with clang r131897 and -x objective-c++, clang produces the following error:
>> "invalid operands to binary expression ('NSOpenGLPixelFormat *' and 'nullptr_t')"
>> 
>> Now, nullptr is a C++0x constant, and NSOpenGLPixelFormat is an Objective C class, but a pointer
>> to it is still a pointer and thus should be comparable against nullptr.
>> 
>> I think. Although I don't think the interaction between Objective-C and C++0x has been defined
>> (yet).
>> 
>> What do *you* think?
> Clang handles pointers to ObjC types and normal types differently. That 
> said, it would make sense to make nullptr be a proper ObjC pointer null 
> constant as well. This would obviously be a language extension. If you 
> want this, you should open a feature request in bugzilla.

Yep, this just sounds like a bug due to how we represent objective c types internally.  Please file a bugzilla.

-Chris



More information about the cfe-dev mailing list