Debian Codegraph @

gcc/testsuite/objc.dg/property/synthesize-11.m

raw
1 /* Contributed by Nicola Pero <[email protected]>, November 2010. */
2 /* { dg-do compile } */
3
4 /* Test errors when @synthesize is used with bitfield instance variables in an incorrect way. */
5
6 #include <stdlib.h>
7 #include <objc/objc.h>
8 #include <objc/runtime.h>
9
10 @interface MyRootClass
11 {
12 Class isa;
13 int countA : 2; /* { dg-message "originally specified here" } */
14 int countB : 3; /* { dg-message "originally specified here" } */
15 }
16 + (id) initialize;
17 + (id) alloc;
18 - (id) init;
19 @property int countA;
20 @property (nonatomic) short countB;
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 countA; /* { dg-error ".atomic. property .countA. is using bit-field instance variable .countA." } */
28 @synthesize countB; /* { dg-error "property .countB. is using instance variable .countB. of incompatible type" } */
29 @end /* { dg-warning "incomplete implementation of class" } */
30 /* { dg-warning "method definition for ..setCountA.. not found" "" { target *-*-* } .-1 } */
31 /* { dg-warning "method definition for ..countA. not found" "" { target *-*-* } .-2 } */