aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/obj-c++.dg/gnu-runtime-2.mm
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/obj-c++.dg/gnu-runtime-2.mm')
-rw-r--r--gcc-4.9/gcc/testsuite/obj-c++.dg/gnu-runtime-2.mm30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/obj-c++.dg/gnu-runtime-2.mm b/gcc-4.9/gcc/testsuite/obj-c++.dg/gnu-runtime-2.mm
new file mode 100644
index 000000000..dd5333889
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/obj-c++.dg/gnu-runtime-2.mm
@@ -0,0 +1,30 @@
+/* Sanity check for GNU-runtime version of constant strings,
+ regardless of runtime used on target system. */
+
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
+
+#include <objc/Object.h>
+#include <string.h>
+#include <stdlib.h>
+
+@interface NXConstantString: Object
+{
+ char *c_string;
+ unsigned int len;
+}
+-(const char *) cString;
+-(unsigned int) length;
+@end
+
+@implementation NXConstantString
+-(const char *) cString { return c_string; }
+-(unsigned int) length { return len; }
+@end
+
+int main(int argc, const char **args)
+{
+ if (strcmp ([@"this is a string" cString], "this is a string"))
+ abort ();
+ return 0;
+}