OSDN Git Service

* trans.c (trans_code): Set backend locus early.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / obj-c++.dg / defs.mm
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/Object1.h"
7 #include <stdlib.h>
8 #include <objc/objc.h>
9
10 extern "C" void abort(void);
11
12 @interface A : Object
13 {
14   @public
15     int a;
16 }
17 @end
18
19 struct 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
33 int 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 #include "../objc-obj-c++-shared/Object1-implementation.h"