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