aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc
diff options
context:
space:
mode:
authorNicola Pero <nicola.pero@meta-innovation.com>2010-11-13 15:53:32 +0000
committerNicola Pero <nicola@gcc.gnu.org>2010-11-13 15:53:32 +0000
commit5a2a6eb0503f631694426849a94ccb8355c7aad9 (patch)
treec667cb4ec1103e130eeb2173f6ac0768f8048e8c /gcc/testsuite/objc
parent4286fd7aec2b44e77d2ca271c6a5aecf6bc753bb (diff)
downloadgcc-5a2a6eb0503f631694426849a94ccb8355c7aad9.zip
gcc-5a2a6eb0503f631694426849a94ccb8355c7aad9.tar.gz
gcc-5a2a6eb0503f631694426849a94ccb8355c7aad9.tar.bz2
In gcc/objc/: 2010-11-13 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/objc/: 2010-11-13 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (objc_get_protocol_qualified_type): detect cases where we are asked to attach a protocol to something which is not an Objective-C object type, and produce an error. In gcc/testsuite/: 2010-11-13 Nicola Pero <nicola.pero@meta-innovation.com> * objc/compile/20060406-1.m: Fixed testcase not to try to qualify a pointer to an arbitrary C struct with an Objective-C protocol. Test various valid uses of typedef with Objective-C objects and protocols instead. * objc.dg/invalid-type-1.m: New. * obj-c++.dg/invalid-type-1.m: New. From-SVN: r166709
Diffstat (limited to 'gcc/testsuite/objc')
-rw-r--r--gcc/testsuite/objc/compile/20060406-1.m56
1 files changed, 50 insertions, 6 deletions
diff --git a/gcc/testsuite/objc/compile/20060406-1.m b/gcc/testsuite/objc/compile/20060406-1.m
index e4496bf..6214890 100644
--- a/gcc/testsuite/objc/compile/20060406-1.m
+++ b/gcc/testsuite/objc/compile/20060406-1.m
@@ -1,21 +1,65 @@
-typedef struct
-{
- void *p;
-} *S;
+/* This test tests typedefs and protocol qualifiers. */
@protocol O
- (unsigned)j;
@end
+@interface T
+@end
+
+
+/* First test. */
+typedef T<O> *S;
+
@interface I
-+ (unsigned char)T:(S<O>[2])p v:(S<O>)h;
++ (unsigned char)T:(S[2])p
+ v:(S)h;
@end
@implementation I
-+ (unsigned char)T:(S<O>[2])p v:(S<O>)h
++ (unsigned char)T:(S[2])p
+ v:(S)h
{
p[0] = (S) 0;
p[1] = (S) 0;
return 0;
}
@end
+
+
+/* Second test. */
+typedef T<O> S1;
+
+@interface I1
++ (unsigned char)T1:(S1*[2])p
+ v1:(S1*)h;
+@end
+
+@implementation I1
++ (unsigned char)T1:(S1*[2])p
+ v1:(S1*)h
+{
+ p[0] = (S1*) 0;
+ p[1] = (S1*) 0;
+ return 0;
+}
+@end
+
+
+/* Third test. */
+typedef T S2;
+
+@interface I2
++ (unsigned char)T1:(S2<O>*[2])p
+ v1:(S2<O>*)h;
+@end
+
+@implementation I2
++ (unsigned char)T1:(S2<O>*[2])p
+ v1:(S2<O>*)h
+{
+ p[0] = (S2<O>*) 0;
+ p[1] = (S2<O>*) 0;
+ return 0;
+}
+@end