* c-common.c (get_priority): Add check for
[official-gcc.git] / gcc / testsuite / obj-c++.dg / cxx-ivars-3.mm
blobca5e5eda4501de21aa1068efd4ae871d89684854
1 // Check if ObjC classes with non-POD C++ ivars are specially marked in the metadata.
3 // { dg-do run { target *-*-darwin* } }
4 // { dg-options "-fobjc-call-cxx-cdtors -fnext-runtime" }
6 #include <objc/objc-runtime.h>
7 #include <stdlib.h>
8 #define CHECK_IF(expr) if(!(expr)) abort()
10 #ifndef CLS_HAS_CXX_STRUCTORS
11 #define CLS_HAS_CXX_STRUCTORS 0x2000L
12 #endif
14 struct cxx_struct {
15   int a, b;
16   cxx_struct (void) { a = b = 55; }
19 @interface Foo {
20   int c;
21   cxx_struct s;
23 @end
25 @interface Bar: Foo {
26   float f;
28 @end
30 @implementation Foo
31 @end
33 @implementation Bar
34 @end
36 int main (void)
38   Class cls;
40   cls = objc_getClass("Foo");
41   CHECK_IF(cls->info & CLS_HAS_CXX_STRUCTORS);
42   cls = objc_getClass("Bar");
43   CHECK_IF(!(cls->info & CLS_HAS_CXX_STRUCTORS));
45   return 0;