summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg
diff options
context:
space:
mode:
authornicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-21 18:51:34 +0000
committernicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-21 18:51:34 +0000
commite93ea189f714f1c8399f57d96a79fe2672807954 (patch)
tree897f0bbb69ee50c5f581e4a8d83c36076bdc3738 /gcc/testsuite/objc.dg
parent2593b7b8135db4d43d62af403237e80b59ea9c9a (diff)
downloadgcc-e93ea189f714f1c8399f57d96a79fe2672807954.tar.gz
PR objc/25965
In gcc/objc/: * objc-act.c (objc_get_interface_ivars): New function. (objc_collecting_ivars): New variable. (continue_class): Set and reset objc_collecting_ivars for context. In gcc/: * c-decl.c (detect_field_duplicates): If compiling Objective-C, call objc_get_interface_ivars (). * c-family/c-common.h (objc_get_interface_ivars): New declaration. * c-family/stub-objc.c (objc_get_interface_ivars): New stub. In gcc/objcp/: * objcp-decl.c (objcp_finish_struct): Call objc_get_interface_ivars() and check for duplicate ivars. In gcc/testsuite/: Merge from 'apple/trunk' branch on FSF servers. 2005-10-11 Fariborz Jahanian <fjahanian@apple.com> Radar 4291785 objc.dg/naming-4.m: New objc.dg/naming-5.m: New obj-c++.dg/naming-1.mm: New obj-c++.dg/naming-2.mm: New git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164491 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/objc.dg')
-rw-r--r--gcc/testsuite/objc.dg/naming-4.m27
-rw-r--r--gcc/testsuite/objc.dg/naming-5.m42
2 files changed, 69 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/naming-4.m b/gcc/testsuite/objc.dg/naming-4.m
new file mode 100644
index 00000000000..9a85229f6a7
--- /dev/null
+++ b/gcc/testsuite/objc.dg/naming-4.m
@@ -0,0 +1,27 @@
+/* Testing for detecting duplicate ivars. */
+/* { dg-do compile } */
+
+typedef struct S { int i; } NSDictionary;
+
+@interface A
+{
+ NSDictionary * _userInfo;
+}
+@end
+
+@interface B : A
+{
+ NSDictionary * _userInfo; /* { dg-error "duplicate member" } */
+ NSDictionary * _userInfo; /* { dg-error "duplicate member" } */
+}
+@end
+
+@interface C : A
+@end
+
+@interface D : C
+{
+ NSDictionary * _userInfo; /* { dg-error "duplicate member" } */
+ NSDictionary * _userInfo; /* { dg-error "duplicate member" } */
+}
+@end
diff --git a/gcc/testsuite/objc.dg/naming-5.m b/gcc/testsuite/objc.dg/naming-5.m
new file mode 100644
index 00000000000..2e2786c41de
--- /dev/null
+++ b/gcc/testsuite/objc.dg/naming-5.m
@@ -0,0 +1,42 @@
+/* Testing for detecting duplicate ivars. */
+/* { dg-do compile } */
+
+typedef struct S { int i; } NSDictionary;
+
+@interface A
+{
+ NSDictionary * _userInfo;
+ int i1;
+ int i2;
+ int i3;
+ int i4;
+ int i5;
+ int i6;
+ int i7;
+}
+@end
+
+@interface B : A
+{
+ NSDictionary * _userInfo; /* { dg-error "duplicate member" } */
+ int ii1;
+ int ii2;
+ int ii3;
+ int ii4;
+ int ii5;
+ int ii6;
+ int ii7;
+ NSDictionary * _userInfo; /* { dg-error "duplicate member" } */
+}
+@end
+
+@interface C : A
+@end
+
+@interface D : C
+{
+ NSDictionary * _userInfo; /* { dg-error "duplicate member" } */
+ NSDictionary * _userInfo; /* { dg-error "duplicate member" } */
+}
+@end
+