[LLVMbugs] [Bug 13845] New: Conflicting method signatures are not an error when using ARC

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Sep 13 21:41:06 PDT 2012


             Bug #: 13845
           Summary: Conflicting method signatures are not an error when
                    using ARC
           Product: clang
           Version: 3.1
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: felixcca at yahoo.ca
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Currently, the following program compiles:

    @interface Foo : NSObject

    @implementation Foo
    -(void)foo {}

Notice that `foo` is supposed to return an `id` but its implementation returns
`void`. This causes clang to emit this warning:

    warning: conflicting return type in implementation of 'foo': 'id' vs 'void'

However, with ARC, this will often cause a crash when you use something like
`id bar = [myFoo foo]`, because it tries to retain an undefined value.

[Section 3.3.1 of the ARC document][1] states that:

> In general, a program which attempts to implicitly or explicitly convert a value of retainable object pointer type to any non-retainable type, or vice-versa, is ill-formed.

`void` to `id` should be a very good example of an illegal conversion.

Currently, ARC conversion rules are enforced with compile-time errors. Clang
should therefore emit an error if incompatible signatures would cause an
illegal conversion (or ban incompatible signatures altogether when using ARC).


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