1 /* Test the -fconstant-string-class=Foo option under the NeXT runtime. */
2 /* Developed by Markus Hitter <mah@jump-ing.de>. */
4 /* { dg-options "-fconstant-string-class=Foo" } */
5 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
7 #import "../objc-obj-c++-shared/Object1.h"
8 #import "../objc-obj-c++-shared/next-mapping.h"
13 @interface Foo: Object {
17 - (char *)customString;
20 #ifdef NEXT_OBJC_USE_NEW_INTERFACE
21 struct fudge_objc_class _FooClassReference;
23 struct objc_class _FooClassReference;
26 @implementation Foo : Object
27 - (char *)customString {
34 Foo *string2 = @"bla";
38 printf("Strings are being uniqued properly\n");
40 /* This memcpy has to be done before the first message is sent to a
41 constant string object. Can't be moved to +initialize since _that_
42 is already a message. */
44 memcpy(&_FooClassReference, objc_get_class("Foo"), sizeof(_FooClassReference));
45 if (strcmp ([string customString], "bla")) {
49 printf([@"This is a working constant string object\n" customString]);
53 #include "../objc-obj-c++-shared/Object1-implementation.h"