[cfe-dev] Curious ObjC typechecking... bug?

Jonathan Roelofs jonathan at codesourcery.com
Thu Apr 9 17:35:35 PDT 2015


Why does the following pass Clang's type checker?

@protocol PF
-(int)pf;
@end

@interface Foo : NSObject <PF>
- (double) pf;
@end

@implementation Foo
- (double) pf { return 2.0; }
@end

It seems to me that there should at least be a "return type differs" 
warning because 'pf' in the protocol has a different signature than 'pf' 
in the interface... if not an error, because 'Foo' doesn't really 
implement 'PF'.

I could also be missing some language rule here. Thoughts?


Jon

-- 
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded



More information about the cfe-dev mailing list