OSDN Git Service

CFStrings for Darwin.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / obj-c++.dg / strings / const-str-12.mm
1 /* Test if ObjC types play nice in conditional expressions.  */
2 /* Author: Ziemowit Laski  */
3
4 /* { dg-do compile } */
5 /* { dg-options "-fconstant-string-class=Foo" } */
6 /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=Foo" { target *-*-darwin* } } */
7
8 #include "../../objc-obj-c++-shared/Object1.h"
9
10 @interface Foo: Object {
11   char *cString;
12   unsigned int len;
13 }
14 + (id)description;
15 @end
16
17 @interface Bar: Object
18 + (Foo *) getString: (int) which;
19 @end
20
21 #ifdef NEXT_OBJC_USE_NEW_INTERFACE
22 Class _FooClassReference;
23 #else
24 struct objc_class _FooClassReference;
25 #endif
26
27 @implementation Bar
28 + (Foo *) getString: (int) which {
29   return which? [Foo description]: @"Hello";
30 }
31 @end