1/* Check @defs() in Objective-C++ */ 2/* Contributed by Devang Patel <dpatel@apple.com> */ 3/* { dg-options "" } */ 4/* { dg-do run } */ 5/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ 6#include "../objc-obj-c++-shared/TestsuiteObject.m" 7#include <stdlib.h> 8#include <objc/objc.h> 9 10extern "C" void abort(void); 11 12@interface A : TestsuiteObject 13{ 14 @public 15 int a; 16} 17@end 18 19struct A_defs 20{ 21 @defs(A); 22}; 23 24@implementation A 25- init 26{ 27 a = 42; 28 return self; 29} 30@end 31 32 33int main() 34{ 35 A *a = [A init]; 36 struct A_defs *a_defs = (struct A_defs *)a; 37 38 if (a->a != a_defs->a) 39 abort (); 40 41 return 0; 42} 43 44