summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/zero-link-3.m
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/objc.dg/zero-link-3.m')
-rw-r--r--gcc/testsuite/objc.dg/zero-link-3.m24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/zero-link-3.m b/gcc/testsuite/objc.dg/zero-link-3.m
new file mode 100644
index 00000000000..af624abf096
--- /dev/null
+++ b/gcc/testsuite/objc.dg/zero-link-3.m
@@ -0,0 +1,24 @@
+/* Check that the '-fzero-link' flag doesn't prevent messaging from working. */
+/* Contributed by Ziemowit Laski <zlaski@apple.com>. */
+/* { dg-options "-fnext-runtime -fzero-link -lobjc" } */
+/* { dg-do run { target *-*-darwin* } } */
+
+#import <objc/objc.h>
+#import <objc/Object.h>
+
+extern void abort(void);
+#define CHECK_IF(expr) if(!(expr)) abort();
+
+@interface Base: Object
++ (int) getValue;
+@end
+
+@implementation Base
++ (int) getValue { return 1593; }
+@end
+
+int main(void) {
+ int val = [Base getValue];
+ CHECK_IF(val == 1593);
+ return 0;
+}