Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / objc.dg / property / dynamic-4.m
blob84998d6b407656751f0cc93c091c1fc636d5e563
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 with protocols.  */
17 @protocol MyProtocol
18 @property int a;
19 @end
22 /* This class is declared to conform to the protocol, but because of
23    @dynamic, no warnings are issued even if the getter/setter for the
24    @property are missing.  */
25 @interface MyClass1 : MyRootClass <MyProtocol>
26 @end
28 @implementation MyClass1
29 @dynamic a;
30 @end
33 /* This class is declared to conform to the protocol and warnings are
34    issued because the setter for the @property is missing.  */
35 @interface MyClass2 : MyRootClass <MyProtocol>
36 @end
38 @implementation MyClass2
39 - (int) a
41   return 0;
43 @end /* { dg-warning "incomplete implementation" } */
44 /* { dg-warning "method definition for .-setA:. not found" "" { target *-*-* } 43 } */
45 /* { dg-warning "class .MyClass2. does not fully implement the .MyProtocol. protocol" "" { target *-*-* } 43 } */