OSDN Git Service

fix PR23716
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / obj-c++.dg / const-str-6.mm
1 /* Negative test case for constant string layout.  */
2 /* Contributed by Ziemowit Laski  <zlaski@apple.com>.  */
3
4 /* { dg-options "-fconstant-string-class=MyConstantString" } */
5 /* { dg-do compile } */
6
7 @interface MyBase {
8   char p;
9 }
10 @end
11
12 @interface MyConstantString: MyBase {
13   union {
14     void     *u;
15     unsigned char   *c;
16   } _contents;
17   char  _count;
18 }
19 @end
20
21 /* The NeXT runtime initializes the 'isa' pointer of string constants at
22    compile time.  */
23 #ifdef __NEXT_RUNTIME__
24 extern void *_MyConstantStringClassReference;
25 #endif
26
27 MyConstantString *str = @"Hello"; /* { dg-error "interface .MyConstantString. does not have valid constant string layout" } */