Re: spurious clang warning
Re: spurious clang warning
- Subject: Re: spurious clang warning
- From: Quincey Morris <email@hidden>
- Date: Thu, 08 Dec 2011 09:46:38 -0800
On Dec 8, 2011, at 00:53 , Jean-Denis MUYS wrote: Anyway, clang (3.0) doesn't like my method and complains that "Incompatible pointer types returning 'Abstract *__strong' from a function with result 'Concrete1*'". This warning (fortunately not an error) seems mistaken to me.
See here:
which says:
Certain methods are candidates to have related result types: - class methods in the alloc and new method families
- instance methods in the init family
- the instance method self
- outside of ARC, the instance methods retain and autorelease
If the formal result type of such a method is id or protocol-qualified id, or a type equal to the declaring class or a superclass, then it is said to have a related result type. In this case, when invoked in an explicit message send, it is assumed to return a type related to the type of the receiver: - if it is a class method, and the receiver is a class name T, the message send _expression_ has type T*; otherwise
- if it is an instance method, and the receiver has type T, the message send _expression_ has type T; otherwise
- the message send _expression_ has the normal result type of the method.
This is a new rule of the Objective-C language and applies outside of ARC.
If you don't want to follow this rule, you'll either need to use a different name for your method, or qualify it with '__attribute__((objc_method_family(none)))' as described in section 5.1.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden