PR target/83368
[official-gcc.git] / gcc / testsuite / obj-c++.dg / strings / const-cfstring-5.mm
blob98bb7c5bddc1b57b5d696d580169bb1c32246694
1 /* Test if constant CFStrings may be passed back as ObjC strings.  */
2 /* Author: Ziemowit Laski  */
4 /* So far, CFString is darwin-only.  */
5 /* { dg-do compile { target *-*-darwin* } } */
6 /* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */
7 /* { dg-options "-mconstant-cfstrings" } */
9 #include <Foundation/NSObject.h>
11 @interface Foo: NSObject {
12   char *cString;
13   unsigned int len;
15 + (Foo *)description;
16 @end
18 @interface Bar: NSObject
19 + (Foo *) getString: (int) which;
20 @end
22 @implementation Bar
23 + (Foo *) getString: (int) which {
24   return which? [Foo description]: @"Hello";
26 @end