Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / objc.dg / protocol-qualifier-1.m
blobc84bfbfa2083fb633c7972a0e31ee7ffcc7e65e6
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
2 /* { dg-do compile } */
4 /* Test that protocol qualifiers work in the same way with @class and @interface.  */
6 #include <objc/objc.h>
8 @protocol MyProtocol
9 - (void) method;
10 @end
13 /* This first snippet gives no warnings, which is correct as 'object'
14    implements <MyProtocol> and hence responds to 'method'.  Note how
15    the details of the class 'MyClass' are never used.  */
16 @interface MyClass
17 @end
19 void test (MyClass <MyProtocol> *object)
21   [object method];
25 /* This second snippet should behave identically.  'object' still implements
26    the same protocol and responds to 'method'.  The details of MyClass or
27    MyClass2 are irrelevant.  */
28 @class MyClass2;
30 void test2 (MyClass2 <MyProtocol> *object)
32   [object method];