summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/method-conflict-3.m
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/objc.dg/method-conflict-3.m
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/objc.dg/method-conflict-3.m')
-rw-r--r--gcc/testsuite/objc.dg/method-conflict-3.m63
1 files changed, 63 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/method-conflict-3.m b/gcc/testsuite/objc.dg/method-conflict-3.m
new file mode 100644
index 000000000..cc4d2631f
--- /dev/null
+++ b/gcc/testsuite/objc.dg/method-conflict-3.m
@@ -0,0 +1,63 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010. */
+/* { dg-do compile } */
+
+#include <objc/objc.h>
+
+/* Test that the compiler can correctly compare protocols in types of
+ method signatures. */
+
+@protocol A, B, C;
+
+@interface MyClass
+- (void) method1: (id)x;
+- (void) method1: (id)x; /* Ok */
+
+- (void) method2: (id <A>)x;
+- (void) method2: (id <A>)x; /* Ok */
+
+- (void) method3: (id <A, B>)x;
+- (void) method3: (id <A, B>)x; /* Ok */
+
+- (void) method4: (id <A, B>)x;
+- (void) method4: (id <A, B, B>)x; /* Ok */
+
+- (void) method5: (id <A, A, B>)x;
+- (void) method5: (id <A, B, B>)x; /* Ok */
+
+- (void) method6: (id <A, A, B, B, C, C>)x;
+- (void) method6: (id <C, A, B>)x; /* Ok */
+
+- (void) method7: (id)x; /* { dg-message "previous declaration" } */
+- (void) method7: (id <A>)x; /* { dg-error "duplicate declaration" } */
+
+- (void) method8: (id <A>)x; /* { dg-message "previous declaration" } */
+- (void) method8: (id)x; /* { dg-error "duplicate declaration" } */
+
+- (void) method9: (id <A>)x; /* { dg-message "previous declaration" } */
+- (void) method9: (id <B>)x; /* { dg-error "duplicate declaration" } */
+
+- (void) methodA: (id <A>)x; /* { dg-message "previous declaration" } */
+- (void) methodA: (id <A, B>)x; /* { dg-error "duplicate declaration" } */
+
+- (void) methodB: (id <A, B>)x; /* { dg-message "previous declaration" } */
+- (void) methodB: (id <A>)x; /* { dg-error "duplicate declaration" } */
+
+- (void) methodC: (id <A, B, C>)x; /* { dg-message "previous declaration" } */
+- (void) methodC: (id <A, B>)x; /* { dg-error "duplicate declaration" } */
+
+- (void) methodD: (id <A, B, C>)x; /* { dg-message "previous declaration" } */
+- (void) methodD: (id <A, B, A>)x; /* { dg-error "duplicate declaration" } */
+
+- (void) methodE: (MyClass <A, B, C> *)x; /* { dg-message "previous declaration" } */
+- (void) methodE: (MyClass <A, B, A> *)x; /* { dg-error "duplicate declaration" } */
+
+- (void) methodF: (MyClass <A, B, A> *)x;
+- (void) methodF: (MyClass <A, B, A> *)x; /* Ok */
+
+- (void) methodG: (MyClass *)x; /* { dg-message "previous declaration" } */
+- (void) methodG: (MyClass <A, B, C> *)x; /* { dg-error "duplicate declaration" } */
+
+- (void) methodH: (MyClass <A, C>*)x; /* { dg-message "previous declaration" } */
+- (void) methodH: (MyClass *)x; /* { dg-error "duplicate declaration" } */
+
+@end