summaryrefslogtreecommitdiff
path: root/gcc/testsuite/obj-c++.dg/lto/trivial-1_0.mm
blob: 45b6e70248106b72ff3cd599442764aba4cbc53b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* { dg-lto-do run } */
/* { dg-skip-if "Needs OBJC2 ABI" { "*-*-darwin*" && lp64 } { "*" } { "" } } */
extern "C" {
extern int printf (char *,...) ;
extern void abort (void) ;
} 

typedef struct objc_class *Class;

struct objc_class {
    Class isa;
    /* other stuff... */
}  ;

@interface myRootObject {
@public
     Class isa; 
}
+initialize;
+(Class)class;

@end

@implementation myRootObject
+initialize {
     return self;
}

+(Class)class {
     return (Class)self;
}

@end

int main(void)
{
  Class cl = [myRootObject class];
  if (cl != (Class)0) {
    printf((char *)"trivial OK\n");
    return 0;
  }
  abort () ;
}