Douglas Gregor | f1d1ca5 | 2011-12-01 01:37:36 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -funknown-anytype -fsyntax-only -fdebugger-support -verify %s |
| 2 | |
| 3 | extern __unknown_anytype test0; |
| 4 | extern __unknown_anytype test1(); |
| 5 | |
| 6 | @interface A |
| 7 | - (int*)getIntPtr; |
| 8 | - (double*)getSomePtr; |
| 9 | @end |
| 10 | |
| 11 | @interface B |
| 12 | - (float*)getFloatPtr; |
| 13 | - (short*)getSomePtr; |
| 14 | @end |
| 15 | |
| 16 | void test_unknown_anytype_receiver() { |
| 17 | int *ip = [test0 getIntPtr]; |
| 18 | float *fp = [test1() getFloatPtr]; |
| 19 | double *dp = [test1() getSomePtr]; // okay: picks first method found |
Sean Callanan | 50a9a12 | 2012-02-04 01:29:37 +0000 | [diff] [blame] | 20 | [[test0 unknownMethod] otherUnknownMethod]; // expected-error{{no known method '-otherUnknownMethod'; cast the message send to the method's return type}} |
Douglas Gregor | f1d1ca5 | 2011-12-01 01:37:36 +0000 | [diff] [blame] | 21 | (void)(int)[[test0 unknownMethod] otherUnknownMethod];; |
Sean Callanan | 50a9a12 | 2012-02-04 01:29:37 +0000 | [diff] [blame] | 22 | [[test1() unknownMethod] otherUnknownMethod]; // expected-error{{no known method '-otherUnknownMethod'; cast the message send to the method's return type}} |
Douglas Gregor | f1d1ca5 | 2011-12-01 01:37:36 +0000 | [diff] [blame] | 23 | (void)(id)[[test1() unknownMethod] otherUnknownMethod]; |
Douglas Gregor | 5e3a8be | 2011-12-15 00:53:32 +0000 | [diff] [blame] | 24 | |
| 25 | if ([[test0 unknownMethod] otherUnknownMethod]) { // expected-error{{no known method '-otherUnknownMethod'; cast the message send to the method's return type}} |
| 26 | } |
| 27 | if ([[test1() unknownMethod] otherUnknownMethod]) { // expected-error{{no known method '-otherUnknownMethod'; cast the message send to the method's return type}} |
| 28 | } |
Douglas Gregor | f1d1ca5 | 2011-12-01 01:37:36 +0000 | [diff] [blame] | 29 | } |