[LLVMbugs] [Bug 11577] New: "[self alloc]" in a class method not inferred to return an instance of that class

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Dec 14 14:15:01 PST 2011


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

             Bug #: 11577
           Summary: "[self alloc]" in a class method not inferred to
                    return an instance of that class
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: tjw at me.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 7735
  --> http://llvm.org/bugs/attachment.cgi?id=7735
test case

The result of +alloc should be inferred to be an instance of the receiving
"self" class here, but is apparently just being typed as "id". This cause clang
to think the -initWithContentsOfFile: and -initWithContentsOfURL: are possibly
the deprecated methods in Foundation.


/Users/bungi/Source/LLVM/llvm/Release+Asserts/bin/clang -c
incorrect-type-inferrence-vs-deprecation.m

incorrect-type-inferrence-vs-deprecation.m:32:14: warning:
'initWithContentsOfFile:' is deprecated [-Wdeprecated-declarations]
    return [[[self alloc] initWithContentsOfFile:path] autorelease];
             ^
incorrect-type-inferrence-vs-deprecation.m:37:14: warning:
'initWithContentsOfURL:' is deprecated [-Wdeprecated-declarations]
    return [[[self alloc] initWithContentsOfURL:url] autorelease];
             ^
2 warnings generated.

-- 
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.



More information about the llvm-bugs mailing list