1 | // RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -verify %s |
2 | // RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin11 -fsyntax-only -verify -DNOARC %s |
3 | #ifdef NOARC |
4 | // expected-no-diagnostics |
5 | #endif |
6 | |
7 | int testObjCComparisonRules(void *v, id x, id y) { |
8 | return v == x; |
9 | #ifndef NOARC |
10 | // expected-error@-2 {{implicit conversion of Objective-C pointer type 'id' to C pointer type 'void *' requires a bridged cast}} |
11 | // expected-note@-3 {{use __bridge to convert directly (no change in ownership)}} |
12 | // expected-note@-4 {{use __bridge_retained to make an ARC object available as a +1 'void *'}} |
13 | #endif |
14 | return v >= x; |
15 | #ifndef NOARC |
16 | // expected-error@-2 {{implicit conversion of Objective-C pointer type 'id' to C pointer type 'void *' requires a bridged cast}} |
17 | // expected-note@-3 {{use __bridge to convert directly (no change in ownership)}} |
18 | // expected-note@-4 {{use __bridge_retained to make an ARC object available as a +1 'void *'}} |
19 | #endif |
20 | return v == (id)(void *)0; // OK |
21 | return v == nullptr; // OK |
22 | return v == (void *)0; |
23 | return x == y; |
24 | } |
25 | |