Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / obj-c++.dg / strings / const-str-5.mm
blob8c12a0c11d35dbd8c68581868ab4167bc2a5ac14
1 /* Positive test case for constant string layout.  */
2 /* Contributed by Ziemowit Laski  <zlaski@apple.com>.  */
4 /* { dg-do compile } */
5 /* { dg-options "-fconstant-string-class=MyConstantString" } */
6 /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=MyConstantString" { target *-*-darwin* } } */
8 @interface MyBase {
9   const char *p;
11 @end
13 @interface MyConstantString: MyBase {
14   union equiv_u {
15     void     *u;
16     unsigned char   *c;
17   } _contents;
18   unsigned int  _count;
20 @end
22 /* The NeXT runtime initializes the 'isa' pointer of string constants at
23    compile time.  */
24 #ifdef __NEXT_RUNTIME__
25 extern void *_MyConstantStringClassReference;
26 #endif
28 MyConstantString *str = @"Hello";