1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
3 typedef struct objc_object {
13 - (void) contents {} // No declaration in @interface!
14 - (void) meth { [self contents]; }
17 typedef struct _NSPoint {
22 typedef struct _NSSize {
27 typedef struct _NSRect {
38 static void func(Helicopter *obj) {
39 // Note that the proto for "rect" is found in the global pool even when
40 // a statically typed object's class interface isn't in scope! This
41 // behavior isn't very desirable, however wee need it for GCC compatibility.
42 NSRect r = [obj rect];
45 @interface NSObject @end
47 extern Class NSClassFromObject(id object);
49 @interface XX : NSObject
59 [NSClassFromObject(self) _privateMethod];
63 @implementation XX (Private)
65 [NSClassFromObject(self) _privateMethod];
70 -(void) nonVararg: (int) x;
74 [ ob nonVararg: 0, 1, 2]; // expected-error {{too many arguments to method call}}
79 [foo bar]; // expected-warning {{method '-bar' not found (return type defaults to 'id')}}
85 struct S { int X; } S;
88 int a = [X somemsg]; // expected-warning {{receiver type 'int' is not 'id'}} \
89 expected-warning {{method '-somemsg' not found}} \
90 expected-error {{incompatible pointer to integer conversion initializing 'int' with an expression of type 'id'}}
91 int b = [S somemsg]; // expected-error {{bad receiver type 'struct S'}}
96 struct objc_object X[10];
98 [X rect]; // expected-warning {{receiver type 'struct objc_object *' is not 'id' or interface pointer, consider casting it to 'id'}}
104 [(id)(p) bar]; // expected-error {{missing '['}} \
105 // expected-error {{expected ']'}} \
106 // expected-note {{to match this '['}} \
107 // expected-warning {{instance method '-bar' not found}}
110 @interface I1 // expected-note {{receiver is instance of class declared here}}
111 -(void)unavail_meth __attribute__((unavailable)); // expected-note {{marked unavailable here}}
117 bar]; // expected-warning {{instance method '-bar' not found}}
119 unavail_meth]; // expected-error {{unavailable}}