aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/obj-c++.dg/protocol-qualifier-1.mm
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/obj-c++.dg/protocol-qualifier-1.mm')
-rw-r--r--gcc-4.9/gcc/testsuite/obj-c++.dg/protocol-qualifier-1.mm33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/obj-c++.dg/protocol-qualifier-1.mm b/gcc-4.9/gcc/testsuite/obj-c++.dg/protocol-qualifier-1.mm
new file mode 100644
index 000000000..c84bfbfa2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/obj-c++.dg/protocol-qualifier-1.mm
@@ -0,0 +1,33 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */
+/* { dg-do compile } */
+
+/* Test that protocol qualifiers work in the same way with @class and @interface. */
+
+#include <objc/objc.h>
+
+@protocol MyProtocol
+- (void) method;
+@end
+
+
+/* This first snippet gives no warnings, which is correct as 'object'
+ implements <MyProtocol> and hence responds to 'method'. Note how
+ the details of the class 'MyClass' are never used. */
+@interface MyClass
+@end
+
+void test (MyClass <MyProtocol> *object)
+{
+ [object method];
+}
+
+
+/* This second snippet should behave identically. 'object' still implements
+ the same protocol and responds to 'method'. The details of MyClass or
+ MyClass2 are irrelevant. */
+@class MyClass2;
+
+void test2 (MyClass2 <MyProtocol> *object)
+{
+ [object method];
+}