http://llvm.org/bugs/show_bug.cgi?id=10164

           Summary: Issue with objc_method_family(init) in class
                    extension.
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


When using the objc_method_family(init) attribute in class extension, clang
does not properly infer the return type and emit a diagnostic to tell it
mismatch (whatever you set as return type).

---------- method_family_init.m
@interface Foo {}
@end

@interface Foo() 
- (id)myinit __attribute__((objc_method_family(init)));
@end

@implementation Foo
- (id)myinit { return self; }
@end

------------
% clang -c method_family_init.m
method_family_init.m:9:1: warning: method is expected to return an instance of
its class type 'Foo', but is declared to return 'id'
- (id)myinit { return self; }
^  ~~
method_family_init.m:5:1: note: overridden method is part of the 'init' method
family
- (id)myinit __attribute__((objc_method_family(init)));
^
1 warning generated.


Note that setting the return type to (Foo *) will not solve the issue as clang
expect 'Foo' and not 'Foo *', which is meaningless in Obj-C.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to