summaryrefslogtreecommitdiff
path: root/gcc/testsuite/obj-c++.dg/gnu-runtime-3.mm
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/obj-c++.dg/gnu-runtime-3.mm')
-rw-r--r--gcc/testsuite/obj-c++.dg/gnu-runtime-3.mm30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/obj-c++.dg/gnu-runtime-3.mm b/gcc/testsuite/obj-c++.dg/gnu-runtime-3.mm
new file mode 100644
index 000000000..429fce3e8
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/gnu-runtime-3.mm
@@ -0,0 +1,30 @@
+/* Test that compiling for the GNU runtime works (regardless of
+ the system runtime used). */
+/* Author: Ziemowit Laski <zlaski@apple.com> */
+/* { dg-do run } */
+/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
+
+#include <objc/Object.h>
+#include <stdlib.h>
+
+@interface FooBar: Object
+- (void)boo;
+@end
+
+int called = 0;
+
+@implementation FooBar
+- (void)boo
+{
+ called ++;
+}
+@end
+
+int main ()
+{
+ id fooBarInst = [[FooBar alloc] init];
+ [fooBarInst boo];
+ if (called != 1)
+ abort ();
+ return 0;
+}