[llvm-bugs] [Bug 26085] New: r249995 causes premature diagnostics during Objective-C method lookup

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 8 12:26:54 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26085

            Bug ID: 26085
           Summary: r249995 causes premature diagnostics during
                    Objective-C method lookup
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bob.wilson at apple.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

r249995 improves clang's handling of overloaded C functions, but it causes a
regression for Objective-C method lookup:

$ cat t.m
struct A { int a; };
@interface B
@end

@interface I1
- (void) test:(struct A *)arg;
@end

@interface I2
- (void) test:(B *)arg;
@end

void f(id x, B *arg) {
 [x test:arg];
}

$ clang -fobjc-arc t.m
t.m:14:10: error: implicit conversion of Objective-C pointer type 'B *' to C
      pointer type 'struct A *' requires a bridged cast
 [x test:arg];
         ^~~
t.m:14:10: note: use __bridge to convert directly (no change in ownership)
 [x test:arg];
         ^
         (__bridge struct A *)( )
t.m:14:10: note: use __bridge_retained to make an ARC object available as a +1
      'struct A *'
 [x test:arg];
         ^
         (__bridge_retained struct A *)( )
1 error generated.

Sema::SelectBestMethod looks at the two candidate "test" methods. It will match
the second one, but in the process of considering the first candidate, the
error diagnostic above is generated. This happens within the call to
CheckSingleAssignmentConstraints that was added in IsStandardConversion by
r249995. The "Diagnose" argument in that call is set to false, but the
diagnostic is generated anyway. In this case, the diagnostic comes from
CheckObjCARCConversion, but it looks like there are some other diagnostics that
could also be generated from within CheckSingleAssignmentConstraints.

This is also tracked by rdar://problem/24111333

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160108/0980499b/attachment.html>


More information about the llvm-bugs mailing list