fix pr/45972
[official-gcc.git] / gcc / testsuite / obj-c++.dg / const-str-12.mm
blobb92b50bcb090161099c004c94c0a1f129f482b81
1 /* Test if ObjC types play nice in conditional expressions.  */
2 /* Author: Ziemowit Laski  */
4 /* { dg-options "-fconstant-string-class=Foo" } */
5 /* { dg-do compile } */
7 #include "../objc-obj-c++-shared/Object1.h"
8 #import "../objc-obj-c++-shared/next-mapping.h"
10 @interface Foo: Object {
11   char *cString;
12   unsigned int len;
14 + (id)description;
15 @end
17 @interface Bar: Object
18 + (Foo *) getString: (int) which;
19 @end
21 #ifdef NEXT_OBJC_USE_NEW_INTERFACE
22 struct fudge_objc_class _FooClassReference;
23 #else
24 struct objc_class _FooClassReference;
25 #endif
27 @implementation Bar
28 + (Foo *) getString: (int) which {
29   return which? [Foo description]: @"Hello";
31 @end