aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/obj-c++.dg/property/dynamic-3.mm
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/obj-c++.dg/property/dynamic-3.mm')
-rw-r--r--gcc-4.9/gcc/testsuite/obj-c++.dg/property/dynamic-3.mm49
1 files changed, 49 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/obj-c++.dg/property/dynamic-3.mm b/gcc-4.9/gcc/testsuite/obj-c++.dg/property/dynamic-3.mm
new file mode 100644
index 000000000..e8a6693b0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/obj-c++.dg/property/dynamic-3.mm
@@ -0,0 +1,49 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */
+/* { dg-do compile } */
+
+#include <objc/objc.h>
+
+@interface MyRootClass
+{
+ Class isa;
+}
+@end
+
+@implementation MyRootClass
+@end
+
+/* Test @property/@dynamic in a category. First, a case where
+ @dynamic should turn off all warnings. */
+
+@interface MyRootClass (Category)
+@property int a;
+- (int) test;
+@end
+@implementation MyRootClass (Category)
+@dynamic a;
+- (int) test
+{
+ return self.a; /* This should compile into [self a] with no warnings. */
+}
+@end
+
+
+
+/* Test @property/@dynamic in a category. Second, a case with a
+ missing setter and no @dynamic. A warning should be generated. */
+
+@interface MyRootClass (Category2)
+@property int b;
+- (int) test;
+@end
+@implementation MyRootClass (Category2)
+- (int) b
+{
+ return 0;
+}
+- (int) test
+{
+ return self.b;
+}
+@end /* { dg-warning "incomplete implementation" } */
+/* { dg-warning "method definition for .-setB:. not found" "" { target *-*-* } 48 } */