Douglas Gregor | b5af2e9 | 2013-03-07 22:57:58 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++11 -fdebugger-support -fdebugger-cast-result-to-id -funknown-anytype -fsyntax-only -verify %s |
| 2 | |
| 3 | extern __unknown_anytype test0a; |
| 4 | extern __unknown_anytype test1a(); |
| 5 | extern __unknown_anytype test0b; |
| 6 | extern __unknown_anytype test1b(); |
| 7 | extern __unknown_anytype test0c; |
| 8 | extern __unknown_anytype test1c(); |
| 9 | extern __unknown_anytype test0d; |
| 10 | extern __unknown_anytype test1d(); |
| 11 | extern __unknown_anytype test0d; |
| 12 | extern __unknown_anytype test1d(); |
| 13 | |
| 14 | @interface A |
| 15 | @end |
Sean Callanan | 8870a32 | 2012-02-04 02:28:18 +0000 | [diff] [blame] | 16 | |
| 17 | // rdar://problem/9416370 |
Douglas Gregor | b5af2e9 | 2013-03-07 22:57:58 +0000 | [diff] [blame] | 18 | namespace rdar9416370 { |
Sean Callanan | 8870a32 | 2012-02-04 02:28:18 +0000 | [diff] [blame] | 19 | void test(id x) { |
| 20 | if ([x foo]) {} // expected-error {{no known method '-foo'; cast the message send to the method's return type}} |
| 21 | [x foo]; |
| 22 | } |
| 23 | } |
Fariborz Jahanian | c8a322a | 2012-03-09 18:47:16 +0000 | [diff] [blame] | 24 | |
| 25 | // rdar://10988847 |
| 26 | @class NSString; // expected-note {{forward declaration of class here}} |
Douglas Gregor | b5af2e9 | 2013-03-07 22:57:58 +0000 | [diff] [blame] | 27 | namespace rdar10988847 { |
| 28 | void test() { |
Fariborz Jahanian | c8a322a | 2012-03-09 18:47:16 +0000 | [diff] [blame] | 29 | id s = [NSString stringWithUTF8String:"foo"]; // expected-warning {{receiver 'NSString' is a forward class and corresponding @interface may not exist}} |
| 30 | } |
| 31 | } |
Douglas Gregor | b5af2e9 | 2013-03-07 22:57:58 +0000 | [diff] [blame] | 32 | |
| 33 | // rdar://13338107 |
| 34 | namespace rdar13338107 { |
| 35 | void test() { |
| 36 | id x1 = test0a; |
| 37 | id x2 = test1a(); |
| 38 | A *x3 = test0b; |
| 39 | A *x4 = test1b(); |
| 40 | auto x5 = test0c; |
| 41 | auto x6 = test1c(); |
| 42 | } |
| 43 | } |