1 // Check if ObjC classes with non-POD C++ ivars are specially marked in the metadata.
3 // { dg-do run { target *-*-darwin* } }
4 // { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } }
5 // { dg-additional-options "-fobjc-call-cxx-cdtors -mmacosx-version-min=10.4 -framework Foundation" }
6 // This test has no equivalent or meaning for m64/ABI V2
7 // { dg-xfail-run-if "No Test Avail" { *-*-darwin* && lp64 } { "-fnext-runtime" } { "" } }
9 #include <objc/objc-runtime.h>
11 #include <Foundation/NSObject.h>
13 //extern "C" { int printf(const char *,...); }
14 #define CHECK_IF(expr) if(!(expr)) abort()
16 #ifndef CLS_HAS_CXX_STRUCTORS
17 #define CLS_HAS_CXX_STRUCTORS 0x2000L
22 cxx_struct (void) { a = b = 55; }
25 @interface Foo: NSObject {
47 cls = objc_getClass("Foo");
48 // printf((const char *)"Foo info %lx\n",cls->info);
49 CHECK_IF((cls->info & CLS_HAS_CXX_STRUCTORS) != 0);
50 cls = objc_getClass("Bar");
51 // printf((const char *)"Bar info %lx\n",cls->info);
52 CHECK_IF((cls->info & CLS_HAS_CXX_STRUCTORS) == 0);
55 /* No test needed or available. */