<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - r249995 causes premature diagnostics during Objective-C method lookup"
   href="https://llvm.org/bugs/show_bug.cgi?id=26085">26085</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>r249995 causes premature diagnostics during Objective-C method lookup
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>bob.wilson@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>