aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/obj-c++.dg/property/property-neg-7.mm
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/obj-c++.dg/property/property-neg-7.mm')
-rw-r--r--gcc-4.9/gcc/testsuite/obj-c++.dg/property/property-neg-7.mm20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/obj-c++.dg/property/property-neg-7.mm b/gcc-4.9/gcc/testsuite/obj-c++.dg/property/property-neg-7.mm
new file mode 100644
index 000000000..4c3d5d7d3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/obj-c++.dg/property/property-neg-7.mm
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+
+@interface NSArray
+{
+ int count;
+}
+@property(readonly) int count;
+@end
+
+@implementation NSArray
+@synthesize count;
+@end
+
+void foo (NSArray *ans[], id pid, id apid[], int i) {
+ NSArray *test;
+ test.count = 1; /* { dg-error "readonly property can not be set" } */
+ ((NSArray *)pid).count = 1; /* { dg-error "readonly property can not be set" } */
+ ((NSArray *)apid[i]).count = 1; /* { dg-error "readonly property can not be set" } */
+ ans[i].count = 3; /* { dg-error "readonly property can not be set" } */
+}