diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/obj-c++.dg/strings/const-str-12.mm')
-rw-r--r-- | gcc-4.9/gcc/testsuite/obj-c++.dg/strings/const-str-12.mm | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/obj-c++.dg/strings/const-str-12.mm b/gcc-4.9/gcc/testsuite/obj-c++.dg/strings/const-str-12.mm new file mode 100644 index 000000000..d0dfb668e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/obj-c++.dg/strings/const-str-12.mm @@ -0,0 +1,34 @@ +/* Test if ObjC types play nice in conditional expressions. */ +/* Author: Ziemowit Laski */ + +/* { dg-do compile } */ +/* { dg-options "-fconstant-string-class=Foo" } */ +/* { dg-options "-mno-constant-cfstrings -fconstant-string-class=Foo" { target *-*-darwin* } } */ + +#ifdef __NEXT_RUNTIME__ +#include <Foundation/NSObject.h> +#define OBJECT NSObject +#else +#include <objc/Object.h> +#define OBJECT Object +#endif +#include "../../objc-obj-c++-shared/objc-test-suite-types.h" + +@interface Foo: OBJECT { + char *cString; + unsigned int len; +} ++ (id)description; +@end + +@interface Bar: OBJECT ++ (Foo *) getString: (int) which; +@end + +TNS_STRING_REF_T _FooClassReference; /* Only used by NeXT. */ + +@implementation Bar ++ (Foo *) getString: (int) which { + return which? [Foo description]: @"Hello"; +} +@end |