Add -Woverriding-method-mismatch:

% cc -Woverriding-method-mismatch -Wall -framework Foundation returnTypeTest.m  
                       
returnTypeTest.m:23:1: warning: conflicting return type in declaration of 
'name': 'NSString *' vs 'NSSet *' [-Woverriding-method-mismatch]
- (NSSet*) name {
^  ~~~~~~
returnTypeTest.m:13:1: note: previous declaration is here
- (NSString*) name;
^  ~~~~~~~~~
1 warning generated.





> On 2015/10/20, at 18:21, Jens Alfke <j...@mooseyard.com> wrote:
> 
> Watch out: the compiler in Xcode 7.1b3 is not detecting mismatched Obj-C 
> return types, at least for methods that return objects. For example, the 
> following compiles with no warnings, even with all typical warning flags 
> enabled:
> 
> @interface Foo : NSObject
> - (NSString*) name;
> @end
> 
> @implementation Foo
> - (NSSet*) name { return nil; }
> @end
> 
> Reported to Apple as rdar://23195007
> 
> —Jens
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list      (Xcode-users@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/xcode-users/clarkcox3%40gmail.com
> 
> This email sent to clarkc...@gmail.com


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (Xcode-users@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to