Debian Codegraph @

gcc/testsuite/objc.dg/property/dynamic-3.m

raw
1 /* Contributed by Nicola Pero <[email protected]>, November 2010. */
2 /* { dg-do compile } */
3
4 #include <objc/objc.h>
5
6 @interface MyRootClass
7 {
8 Class isa;
9 }
10 @end
11
12 @implementation MyRootClass
13 @end
14
15 /* Test @property/@dynamic in a category. First, a case where
16 @dynamic should turn off all warnings. */
17
18 @interface MyRootClass (Category)
19 @property int a;
20 - (int) test;
21 @end
22 @implementation MyRootClass (Category)
23 @dynamic a;
24 - (int) test
25 {
26 return self.a; /* This should compile into [self a] with no warnings. */
27 }
28 @end
29
30
31
32 /* Test @property/@dynamic in a category. Second, a case with a
33 missing setter and no @dynamic. A warning should be generated. */
34
35 @interface MyRootClass (Category2)
36 @property int b;
37 - (int) test;
38 @end
39 @implementation MyRootClass (Category2)
40 - (int) b
41 {
42 return 0;
43 }
44 - (int) test
45 {
46 return self.b;
47 }
48 @end /* { dg-warning "incomplete implementation" } */
49 /* { dg-warning "method definition for .-setB:. not found" "" { target *-*-* } .-1 } */