blob: edc0c0ecb8294759605d97f10d023a9964fb15d8 [file] [log] [blame]
Fariborz Jahaniancefe5922009-08-08 23:32:22 +00001// RUNX: clang-cc -triple x86_64-apple-darwin -S %s -o %t-64.s &&
2// RUNX: FileCheck -check-prefix LP64 --input-file=%t-64.s %s &&
3// RUN: clang-cc -triple i386-apple-darwin -S %s -o %t-32.s &&
4// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s &&
5// RUN: true
6
7extern "C" int printf(...);
8
9int init = 100;
10
11struct M {
12 int iM;
13 M() : iM(init++) {}
14};
15
16struct N {
17 int iN;
18 N() : iN(200) {}
19 N(N const & arg){this->iN = arg.iN; }
20};
21
22struct P {
23 int iP;
24 P() : iP(init++) {}
25};
26
27
28struct X : M, N, P { // ...
29 X(){}
30 P p0;
31 void pr() { printf("iM = %d iN = %d, m1.iM = %d\n", iM, iN, m1.iM);
32 printf("im = %d p0.iP = %d, p1.iP = %d\n", iP, p0.iP, p1.iP); }
33 M m1;
34 P p1;
35};
36
37int main()
38{
39 X a;
40 X b(a);
41 b.pr();
42 X x;
43 X c(x);
44 c.pr();
45}
46#if 0
47// -m64 does not work due to unrelated llvm bug!
48// CHECK-LP64: .globl __ZN1XC1ERK1X
49// CHECK-LP64: .weak_definition __ZN1XC1ERK1X
50// CHECK-LP64: __ZN1XC1ERK1X:
51#endif
52
53// CHECK-LP32: .globl __ZN1XC1ERK1X
54// CHECK-LP32: .weak_definition __ZN1XC1ERK1X
55// CHECK-LP32: __ZN1XC1ERK1X: