aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/obj-c++.dg/const-str-11.mm
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/obj-c++.dg/const-str-11.mm')
-rw-r--r--gcc/testsuite/obj-c++.dg/const-str-11.mm28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/obj-c++.dg/const-str-11.mm b/gcc/testsuite/obj-c++.dg/const-str-11.mm
new file mode 100644
index 00000000000..de3107cb33d
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/const-str-11.mm
@@ -0,0 +1,28 @@
+/* APPLE LOCAL file 4149909 */
+/* Test if ObjC constant string layout is checked properly, regardless of how
+ constant string classes get derived. */
+/* Contributed by Ziemowit Laski <zlaski@apple.com> */
+
+/* { dg-options "-fnext-runtime -fno-constant-cfstrings -fconstant-string-class=XStr" } */
+/* { dg-do compile { target *-*-darwin* } } */
+
+#include <objc/Object.h>
+
+@interface XString: Object {
+@protected
+ char *bytes;
+}
+@end
+
+@interface XStr : XString {
+@public
+ unsigned int len;
+}
+@end
+
+extern struct objc_class _XStrClassReference;
+
+const XStr *appKey = @"MyApp";
+
+/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */
+/* { dg-final { scan-assembler ".long\t__XStrClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" } } */