| 1 |
/* { dg-do compile } */ |
| 2 |
|
| 3 |
#include <objc/objc.h> |
| 4 |
|
| 5 |
@interface MyRootClass |
| 6 |
{ |
| 7 |
Class isa; |
| 8 |
} |
| 9 |
@end |
| 10 |
|
| 11 |
@implementation MyRootClass |
| 12 |
@end |
| 13 |
|
| 14 |
@synthesize isa; /* { dg-error ".@synthesize. not in @implementation context" } */ |
| 15 |
|
| 16 |
@interface Test : MyRootClass |
| 17 |
{ |
| 18 |
int v1; |
| 19 |
int v2; |
| 20 |
int v3; |
| 21 |
int v4; |
| 22 |
int v5; |
| 23 |
int v6; |
| 24 |
int v7; |
| 25 |
int v8; |
| 26 |
} |
| 27 |
@property int v1; |
| 28 |
@property int v2; |
| 29 |
@property int v3; |
| 30 |
@property int v4; |
| 31 |
@property int v5; |
| 32 |
@property int v6; |
| 33 |
@property int v7; |
| 34 |
@property int v8; |
| 35 |
@end |
| 36 |
|
| 37 |
@implementation Test |
| 38 |
@synthesize; /* { dg-error "expected identifier" } */ |
| 39 |
@synthesize v1, ; /* { dg-error "expected identifier" } */ |
| 40 |
@synthesize v2, v3 = ; /* { dg-error "expected identifier" } */ |
| 41 |
@synthesize v4, v5=v6, v6 = v5,v7; |
| 42 |
@synthesize v8; |
| 43 |
/* Some of the @synthesize above will fail due to syntax errors. The |
| 44 |
compiler will then complain that the methods implementing the |
| 45 |
properties are missing. That is correct, but we are not |
| 46 |
interested. The following ones shut up the compiler. */ |
| 47 |
- (int) v1 { return v1; } |
| 48 |
- (void) setV1: (int)a { v1 = a; } |
| 49 |
- (int) v2 { return v2; } |
| 50 |
- (void) setV2: (int)a { v2 = a; } |
| 51 |
- (int) v3 { return v3; } |
| 52 |
- (void) setV3: (int)a { v3 = a; } |
| 53 |
@end |