| 1 |
/* Contributed by Nicola Pero <[email protected]>, November 2010. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
|
| 4 |
/* Test the 'dot syntax' without a declarated property. This tests |
| 5 |
syntax errors in the case where the object is a Class. */ |
| 6 |
|
| 7 |
|
| 8 |
#include <stdlib.h> |
| 9 |
#include <objc/objc.h> |
| 10 |
#include <objc/runtime.h> |
| 11 |
|
| 12 |
@interface MyRootClass |
| 13 |
{ |
| 14 |
Class isa; |
| 15 |
} |
| 16 |
+ (id) initialize; |
| 17 |
+ (id) alloc; |
| 18 |
- (id) init; |
| 19 |
@end |
| 20 |
|
| 21 |
@implementation MyRootClass |
| 22 |
+ (id) initialize { return self; } |
| 23 |
+ (id) alloc { return class_createInstance (self, 0); } |
| 24 |
- (id) init { return self; } |
| 25 |
@end |
| 26 |
|
| 27 |
int main (void) |
| 28 |
{ |
| 29 |
MyRootClass.invalid = 40; /* { dg-error "could not find setter.getter" } */ |
| 30 |
if (MyRootClass.invalid != 40) /* { dg-error "could not find setter.getter" } */ |
| 31 |
abort (); |
| 32 |
|
| 33 |
MyRootClass.; /* { dg-error "expected identifier" } */ |
| 34 |
if (MyRootClass.) /* { dg-error "expected identifier" } */ |
| 35 |
abort (); |
| 36 |
|
| 37 |
MyRootClass.int; /* { dg-error "expected identifier" } */ |
| 38 |
if (MyRootClass.int) /* { dg-error "expected identifier" } */ |
| 39 |
abort (); |
| 40 |
|
| 41 |
return 0; |
| 42 |
} |