1 // RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -verify %s -fobjc-arc
3 // These tests exist as a means to help ensure that diagnostics aren't printed
4 // in overload resolution in ObjC.
6 struct Type1 { int a; };
7 typedef const __attribute__((objc_bridge(id))) void * CFTypeRef;
10 @interface NeverCalled
11 - (void) test:(struct Type1 *)arg;
12 - (void) test2:(CFTypeRef)arg;
15 @interface TakesIface1
16 - (void) test:(Iface1 *)arg;
17 - (void) test2:(Iface1 *)arg;
21 void testTakesIface1(id x, Iface1 *arg) {
22 // This should resolve silently to `TakesIface1`.
28 @interface NeverCalledv2
29 - (void) testStr:(NSString *)arg;
32 @interface TakesVanillaConstChar
33 - (void) testStr:(const void *)a;
36 // Not called out explicitly by PR26085, but related.
37 void testTakesNSString(id x) {
38 // Overload resolution should not emit a diagnostic about needing to add an
39 // '@' before "someStringLiteral".
40 [x testStr:"someStringLiteral"];
43 id CreateSomething(void);
45 @interface TakesCFTypeRef
46 - (void) testCFTypeRef:(CFTypeRef)arg;
49 @interface NeverCalledv3
50 - (void) testCFTypeRef:(struct Type1 *)arg;
53 // Not called out explicitly by PR26085, but related.
54 void testTakesCFTypeRef(id x) {
55 // Overload resolution should occur silently, select the CFTypeRef overload,
56 // and produce a single complaint. (with notes)
57 [x testCFTypeRef:CreateSomething()]; // expected-error{{implicit conversion of Objective-C pointer type 'id' to C pointer type 'CFTypeRef'}} expected-note{{use __bridge}} expected-note{{use __bridge_retained}}