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'}}
103 [(id)(p) bar]; // expected-error {{missing '['}} \
104 // expected-error {{expected ']'}} \
105 // expected-note {{to match this '['}} \
106 // expected-warning {{instance method '-bar' not found}}
109 @interface I1 // expected-note {{receiver is instance of class declared here}}
110 -(void)unavail_meth __attribute__((unavailable)); // expected-note {{marked unavailable here}}
115 bar]; // expected-warning {{instance method '-bar' not found}}
117 unavail_meth]; // expected-error {{unavailable}}