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

jahanian fjahanian at apple.com
Fri Apr 10 08:54:29 PDT 2015


Try -Woverriding-method-mismatch option.

- Fariborz

> On Apr 9, 2015, at 5:35 PM, Jonathan Roelofs <jonathan at codesourcery.com> wrote:
> 
> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150410/6f7dd6da/attachment.html>


More information about the cfe-dev mailing list