Debian Codegraph @

gcc/testsuite/objc.dg/strings/const-str-12b.m

raw
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 #ifdef __NEXT_RUNTIME__
9 # include "../../objc-obj-c++-shared/F-NSObject.h"
10 # define OBJECT NSObject
11 #else
12 # include <objc/Object.h>
13 # define OBJECT Object
14 #endif
15 #include "../../objc-obj-c++-shared/objc-test-suite-types.h"
16
17 @interface Foo: OBJECT {
18 char *cString;
19 unsigned int len;
20 }
21 + (id)description;
22 @end
23
24 @interface Bar: OBJECT
25 + (Foo *) getString: (int) which;
26 @end
27
28 TNS_STRING_REF_T _FooClassReference; /* Only used by NeXT. */
29
30 @implementation Bar
31 + (Foo *) getString: (int) which {
32 return which? [Foo description]: @"Hello";
33 }
34 @end