[cfe-dev] Obj-C false positive warning with deprecation and instancetype?

Sean McBride sean at rogue-research.com
Wed Jan 11 12:24:38 PST 2012


On Wed, 11 Jan 2012 12:02:32 -0800, jahanian said:

>>> If alloc is using instancetype then you shouldn't see this warning.
>Please file a bug report with the pre-processed file.
>>> 
>> 
>> According to clang doc, "+alloc implicitly has a related result type".
>So clang should be able to determine what the return type is.
>
>Can you point to the document? This can't be part of the 'clang' doc.
>'alloc' need to use instancetype for type deduction purposes. Legacy
>frameworks use 'id' for 'alloc' type.

It's here:

<http://clang.llvm.org/docs/LanguageExtensions.html#objc_instancetype>

"The related result type can also be inferred for some methods. To determine whether a method has an inferred related result type, the first word in the camel-case selector (e.g., "init" in "initWithObjects") is considered....."

This doc is exactly what's lead me to believe this is a false positive.

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada






More information about the cfe-dev mailing list