* lto.c (do_stream_out): Add PART parameter; open dump file.
[official-gcc.git] / gcc / testsuite / obj-c++.dg / cxx-ivars-3.mm
blob0098349cbceeefab32ba4a10437fcceb57d8401a
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>
10 #include <stdlib.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
18 #endif
20 struct cxx_struct {
21   int a, b;
22   cxx_struct (void) { a = b = 55; }
25 @interface Foo: NSObject {
26   int c;
27   cxx_struct s;
29 @end
31 @interface Bar: Foo {
32   float f;
34 @end
36 @implementation Foo
37 @end
39 @implementation Bar
40 @end
42 int main (void)
44 #ifndef __LP64__
45   Class cls;
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);
54 #else
55   /* No test needed or available.  */
56   abort ();
57 #endif
58   return 0;