2013-10-29 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / obj-c++.dg / property / dotsyntax-14.mm
blobefa60ed99c18024845f6eae0918a1e3eb6083b6a
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
2 /* { dg-do compile } */
4 /* Test dot-syntax with accessors to be looked up in protocol @properties.  */
6 #include <stdlib.h>
7 #include <objc/objc.h>
8 #include <objc/runtime.h>
10 @protocol ProtocolA
11 @property int countA;
12 @end
14 @protocol ProtocolB
15 @property int countB;
16 @end
18 @protocol ProtocolC
19 @property int countC;
20 @end
22 @interface MyRootClass
24   Class isa;
26 + (id) initialize;
27 + (id) alloc;
28 - (id) init;
29 @end
31 @interface MySubClass <ProtocolA, ProtocolB, ProtocolC>
32 @end
34 int function (MySubClass *object, int x)
36   object.countA = x;
37   object.countB = x;
38   object.countC = object.countB;
40   return object.countC;
43 int function2 (MyRootClass <ProtocolA, ProtocolB, ProtocolC> *object, int x)
45   object.countA = x;
46   object.countB = x;
47   object.countC = object.countB;
49   return object.countC;
52 int function3 (MyRootClass <ProtocolA, ProtocolB> *object, int x)
54   object.countA = x;
55   object.countB = x;
56   object.countC = object.countB; /* { dg-error "request for member .countC. in" } */
58   return object.countC;          /* { dg-error "request for member .countC. in" } */
61 int function4 (id <ProtocolA, ProtocolB, ProtocolC> object, int x)
63   object.countA = x;
64   object.countB = x;
65   object.countC = object.countB;
67   return object.countC;
70 int function5 (id <ProtocolA, ProtocolB> object, int x)
72   object.countA = x;
73   object.countB = x;
74   object.countC = object.countB; /* { dg-error "request for member .countC. in" } */
76   return object.countC;          /* { dg-error "request for member .countC. in" } */