1 /* Test out static (non-heap) allocations of ObjC class instances.
2 These should elicit errors. */
3 /* Developed by Ziemowit Laski <zlaski@apple.com>. */
4 /* { dg-do compile } */
7 struct objc_class *isa;
11 @compatibility_alias MyObject Object;
13 @interface Foo: Object {
16 Object c; /* { dg-error "statically allocated instance of Objective-C class .Object." } */
20 @compatibility_alias MyFoo Foo;
22 typedef Foo FooAlias1;
23 typedef FooAlias1 FooAlias2;
24 typedef Object ObjectAlias1;
25 typedef struct Object ObjectAlias2;
26 Object staticObject1; /* { dg-error "statically allocated instance of Objective-C class .Object." } */
27 struct Object staticObject2; /* { dg-error "statically allocated instance of Objective-C class .Object." } */
28 static ObjectAlias1 staticObject3; /* { dg-error "statically allocated instance of Objective-C class .Object." } */
29 FooAlias1 staticFoo1; /* { dg-error "statically allocated instance of Objective-C class .Foo." } */
30 extern FooAlias2 externFoo1; /* { dg-error "statically allocated instance of Objective-C class .Foo." } */
31 static Foo staticFoo2; /* { dg-error "statically allocated instance of Objective-C class .Foo." } */
32 MyObject staticMyObject1; /* { dg-error "statically allocated instance of Objective-C class .Object." } */
33 MyFoo staticMyFoo1; /* { dg-error "statically allocated instance of Objective-C class .Foo." } */