1 | // RUN: %clang_cc1 -fdebugger-support -funknown-anytype -fsyntax-only -verify %s |
2 | |
3 | // rdar://problem/9416370 |
4 | namespace test0 { |
5 | void test(id x) { |
6 | if ([x foo]) {} // expected-error {{no known method '-foo'; cast the message send to the method's return type}} |
7 | [x foo]; // expected-error {{no known method '-foo'; cast the message send to the method's return type}} |
8 | } |
9 | } |
10 | |
11 | // rdar://problem/12565338 |
12 | @interface Test1 |
13 | - (void) test_a: (__unknown_anytype)foo; |
14 | - (void) test_b: (__unknown_anytype)foo; |
15 | - (void) test_c: (__unknown_anytype)foo; |
16 | @end |
17 | namespace test1 { |
18 | struct POD { |
19 | int x; |
20 | }; |
21 | |
22 | void a(Test1 *obj) { |
23 | POD v; |
24 | [obj test_a: v]; |
25 | } |
26 | |
27 | struct Uncopyable { |
28 | Uncopyable(); |
29 | private: |
30 | Uncopyable(const Uncopyable &); // expected-note {{declared private here}} |
31 | }; |
32 | |
33 | void b(Test1 *obj) { |
34 | Uncopyable v; |
35 | [obj test_b: v]; // expected-error {{calling a private constructor}} |
36 | } |
37 | |
38 | void c(Test1 *obj) { |
39 | Uncopyable v; |
40 | [obj test_c: (const Uncopyable&) v]; |
41 | } |
42 | } |
43 | |
44 | // Just test that we can declare a function taking __unknown_anytype. |
45 | // For now, we don't actually need to make calling something like this |
46 | // work; if that changes, here's what's required: |
47 | // - get this call through overload resolution somehow, |
48 | // - update the function-call argument-passing code like the |
49 | // message-send code, and |
50 | // - rewrite the function expression to have a type that doesn't |
51 | // involving __unknown_anytype. |
52 | namespace test2 { |
53 | void foo(__unknown_anytype x); |
54 | } |
55 | |