brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 62ee4cf Raw
30 lines · plain
1// RUN: %clang_cc1 -funknown-anytype -fsyntax-only -fdebugger-support -verify %s2 3extern __unknown_anytype test0;4extern __unknown_anytype test1(void);5 6@interface A7- (int*)getIntPtr;8- (double*)getSomePtr;9@end10 11@interface B12- (float*)getFloatPtr;13- (short*)getSomePtr;14@end15 16void test_unknown_anytype_receiver(void) {17  int *ip = [test0 getIntPtr];18  float *fp = [test1() getFloatPtr];19  double *dp = [test1() getSomePtr]; // okay: picks first method found20  [[test0 unknownMethod] otherUnknownMethod]; // expected-error{{no known method '-otherUnknownMethod'; cast the message send to the method's return type}}21  (void)(int)[[test0 unknownMethod] otherUnknownMethod];;22  [[test1() unknownMethod] otherUnknownMethod]; // expected-error{{no known method '-otherUnknownMethod'; cast the message send to the method's return type}}23  (void)(id)[[test1() unknownMethod] otherUnknownMethod];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  }29}30