// Check if ObjC classes with non-POD C++ ivars are specially marked in the metadata.
|
// Check if ObjC classes with non-POD C++ ivars are specially marked in the metadata.
|
|
|
// { dg-do run { target *-*-darwin* } }
|
// { dg-do run { target *-*-darwin* } }
|
// { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } }
|
// { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } }
|
// { dg-options "-fobjc-call-cxx-cdtors -mmacosx-version-min=10.4" }
|
// { dg-options "-fobjc-call-cxx-cdtors -mmacosx-version-min=10.4" }
|
// This test has no equivalent or meaning for m64/ABI V2
|
// This test has no equivalent or meaning for m64/ABI V2
|
// { dg-xfail-run-if "No Test Avail" { *-*-darwin* && lp64 } { "-fnext-runtime" } { "" } }
|
// { dg-xfail-run-if "No Test Avail" { *-*-darwin* && lp64 } { "-fnext-runtime" } { "" } }
|
|
|
#include
|
#include
|
#include
|
#include
|
#define CHECK_IF(expr) if(!(expr)) abort()
|
#define CHECK_IF(expr) if(!(expr)) abort()
|
|
|
#ifndef CLS_HAS_CXX_STRUCTORS
|
#ifndef CLS_HAS_CXX_STRUCTORS
|
#define CLS_HAS_CXX_STRUCTORS 0x2000L
|
#define CLS_HAS_CXX_STRUCTORS 0x2000L
|
#endif
|
#endif
|
|
|
struct cxx_struct {
|
struct cxx_struct {
|
int a, b;
|
int a, b;
|
cxx_struct (void) { a = b = 55; }
|
cxx_struct (void) { a = b = 55; }
|
};
|
};
|
|
|
@interface Foo {
|
@interface Foo {
|
int c;
|
int c;
|
cxx_struct s;
|
cxx_struct s;
|
}
|
}
|
@end
|
@end
|
|
|
@interface Bar: Foo {
|
@interface Bar: Foo {
|
float f;
|
float f;
|
}
|
}
|
@end
|
@end
|
|
|
@implementation Foo
|
@implementation Foo
|
@end
|
@end
|
|
|
@implementation Bar
|
@implementation Bar
|
@end
|
@end
|
|
|
int main (void)
|
int main (void)
|
{
|
{
|
#ifndef __LP64__
|
#ifndef __LP64__
|
Class cls;
|
Class cls;
|
|
|
cls = objc_getClass("Foo");
|
cls = objc_getClass("Foo");
|
CHECK_IF(cls->info & CLS_HAS_CXX_STRUCTORS);
|
CHECK_IF(cls->info & CLS_HAS_CXX_STRUCTORS);
|
cls = objc_getClass("Bar");
|
cls = objc_getClass("Bar");
|
CHECK_IF(!(cls->info & CLS_HAS_CXX_STRUCTORS));
|
CHECK_IF(!(cls->info & CLS_HAS_CXX_STRUCTORS));
|
|
|
#else
|
#else
|
/* No test needed or available. */
|
/* No test needed or available. */
|
abort ();
|
abort ();
|
#endif
|
#endif
|
return 0;
|
return 0;
|
}
|
}
|
|
|