Steve Naroff | c43d868 | 2007-11-11 00:10:47 +0000 | [diff] [blame] | 1 | // 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 Naroff | 0416fb9 | 2007-11-11 17:19:15 +0000 | [diff] [blame] | 9 | - (void) meth { [self contents]; } |
Steve Naroff | c43d868 | 2007-11-11 00:10:47 +0000 | [diff] [blame] | 10 | @end |
| 11 | |
Steve Naroff | a924e7c | 2007-12-11 03:34:41 +0000 | [diff] [blame] | 12 | typedef struct _NSPoint { |
| 13 | float x; |
| 14 | float y; |
| 15 | } NSPoint; |
| 16 | |
| 17 | typedef struct _NSSize { |
| 18 | float width; |
| 19 | float height; |
| 20 | } NSSize; |
| 21 | |
| 22 | typedef struct _NSRect { |
| 23 | NSPoint origin; |
| 24 | NSSize size; |
| 25 | } NSRect; |
| 26 | |
| 27 | @interface AnyClass |
| 28 | - (NSRect)rect; |
| 29 | @end |
| 30 | |
| 31 | @class Helicopter; |
| 32 | |
| 33 | static 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 Naroff | a56f616 | 2007-12-18 01:30:32 +0000 | [diff] [blame] | 39 | |
| 40 | @interface NSObject @end |
| 41 | |
| 42 | extern 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 Dunbar | 91e19b2 | 2008-09-11 00:50:25 +0000 | [diff] [blame] | 64 | @interface I0 |
| 65 | -(void) nonVararg: (int) x; |
| 66 | @end |
| 67 | |
| 68 | int f0(I0 *ob) { |
Chris Lattner | 2c21a07 | 2008-11-21 18:44:24 +0000 | [diff] [blame] | 69 | [ ob nonVararg: 0, 1, 2]; // expected-error {{too many arguments to method call}} |
Daniel Dunbar | 91e19b2 | 2008-09-11 00:50:25 +0000 | [diff] [blame] | 70 | } |