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: unassignedclangb...@nondot.org
          Reporter: bob.wil...@apple.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to