summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/pr23214.m
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/objc.dg/pr23214.m')
-rw-r--r--gcc/testsuite/objc.dg/pr23214.m38
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/pr23214.m b/gcc/testsuite/objc.dg/pr23214.m
new file mode 100644
index 000000000..d8092a806
--- /dev/null
+++ b/gcc/testsuite/objc.dg/pr23214.m
@@ -0,0 +1,38 @@
+/* Test that there is no problem initializing multiple static
+ Protocol instances. */
+
+/* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+
+#include <objc/Protocol.h>
+
+#ifdef __OBJC2__
+/* The ObjC V2 "Object" does not provide -class. */
+@interface Object (TS_CAT)
+- class;
+@end
+
+@implementation Object (TS_CAT)
+- class { return isa; }
+@end
+#endif
+
+@protocol A
+@end
+
+@protocol B
+@end
+
+@interface Dummy : Object <B>
+@end
+
+int main ()
+{
+ [@protocol(A) class];
+ [@protocol(B) class];
+
+ return 0;
+}
+
+@implementation Dummy
+@end