Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / objc.dg / property / dynamic-3.m
blobe8a6693b04e8f7999c4b437f7adb74fea088dca9
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
2 /* { dg-do compile } */
4 #include <objc/objc.h>
6 @interface MyRootClass
8   Class isa;
10 @end
12 @implementation MyRootClass
13 @end
15 /* Test @property/@dynamic in a category.  First, a case where
16    @dynamic should turn off all warnings.  */
18 @interface MyRootClass (Category)
19 @property int a;
20 - (int) test;
21 @end
22 @implementation MyRootClass (Category)
23 @dynamic a;
24 - (int) test
26   return self.a; /* This should compile into [self a] with no warnings.  */
28 @end
32 /* Test @property/@dynamic in a category.  Second, a case with a
33    missing setter and no @dynamic.  A warning should be generated.  */
35 @interface MyRootClass (Category2)
36 @property int b;
37 - (int) test;
38 @end
39 @implementation MyRootClass (Category2)
40 - (int) b
42   return 0;
44 - (int) test
46   return self.b;
48 @end /* { dg-warning "incomplete implementation" } */
49 /* { dg-warning "method definition for .-setB:. not found" "" { target *-*-* } 48 } */