Debian Codegraph @

gcc/testsuite/objc.dg/property/at-property-unavailable-1.m

raw
1 /* Test __attribute__ ((unavailable)) */
2 /* { dg-do compile } */
3 /* { dg-options "" } */
4 /* { dg-additional-options "-Wno-objc-root-class" } */
5
6 /* Test that properties can be unavailable. */
7
8 #include <stdlib.h>
9 #include <objc/objc.h>
10 #include <objc/runtime.h>
11
12 @interface MyRootClass
13 {
14 Class isa;
15 int a;
16 }
17 @property int a __attribute__((unavailable));
18 + (id) initialize;
19 + (id) alloc;
20 - (id) init;
21 @end
22
23 @implementation MyRootClass
24 + (id) initialize { return self; }
25 + (id) alloc { return class_createInstance (self, 0); }
26 - (id) init { return self; }
27 @synthesize a;
28 @end
29
30 int main (void)
31 {
32 MyRootClass *object = [[MyRootClass alloc] init];
33
34 object.a = 40; /* { dg-error "is unavailable" } */
35 if (object.a != 40) /* { dg-error "is unavailable" } */
36 abort ();
37
38 return 0;
39 }