blob: 274885d37c55628920cd8bf8f5e94d2e8273746f [file] [log] [blame]
Steve Naroffc43d8682007-11-11 00:10:47 +00001// RUN: clang -fsyntax-only -verify %s
2
3@interface foo
4- (void)meth;
5@end
6
7@implementation foo
8- (void) contents {} // No declaration in @interface!
Steve Naroff0416fb92007-11-11 17:19:15 +00009- (void) meth { [self contents]; }
Steve Naroffc43d8682007-11-11 00:10:47 +000010@end
11
Steve Naroffa924e7c2007-12-11 03:34:41 +000012typedef struct _NSPoint {
13 float x;
14 float y;
15} NSPoint;
16
17typedef struct _NSSize {
18 float width;
19 float height;
20} NSSize;
21
22typedef struct _NSRect {
23 NSPoint origin;
24 NSSize size;
25} NSRect;
26
27@interface AnyClass
28- (NSRect)rect;
29@end
30
31@class Helicopter;
32
33static void func(Helicopter *obj) {
34 // Note that the proto for "rect" is found in the global pool even when
35 // a statically typed object's class interface isn't in scope! This
36 // behavior isn't very desirable, however wee need it for GCC compatibility.
37 NSRect r = [obj rect];
38}
Steve Naroffa56f6162007-12-18 01:30:32 +000039
40@interface NSObject @end
41
42extern Class NSClassFromObject(id object);
43
44@interface XX : NSObject
45@end
46
47@implementation XX
48
49+ _privateMethod {
50 return self;
51}
52
53- (void) xx {
54 [NSClassFromObject(self) _privateMethod];
55}
56@end
57
58@implementation XX (Private)
59- (void) yy {
60 [NSClassFromObject(self) _privateMethod];
61}
62@end
63
Daniel Dunbar91e19b22008-09-11 00:50:25 +000064@interface I0
65-(void) nonVararg: (int) x;
66@end
67
68int f0(I0 *ob) {
Chris Lattner2c21a072008-11-21 18:44:24 +000069 [ ob nonVararg: 0, 1, 2]; // expected-error {{too many arguments to method call}}
Daniel Dunbar91e19b22008-09-11 00:50:25 +000070}