Fariborz Jahanian | 0dfaec4 | 2009-08-10 17:20:45 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -triple x86_64-apple-darwin -S %s -o %t-64.s && |
| 2 | // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && |
Fariborz Jahanian | cefe592 | 2009-08-08 23:32:22 +0000 | [diff] [blame] | 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 | |
| 7 | extern "C" int printf(...); |
| 8 | |
| 9 | int init = 100; |
| 10 | |
| 11 | struct M { |
| 12 | int iM; |
| 13 | M() : iM(init++) {} |
| 14 | }; |
| 15 | |
| 16 | struct N { |
| 17 | int iN; |
| 18 | N() : iN(200) {} |
| 19 | N(N const & arg){this->iN = arg.iN; } |
| 20 | }; |
| 21 | |
| 22 | struct P { |
| 23 | int iP; |
| 24 | P() : iP(init++) {} |
| 25 | }; |
| 26 | |
| 27 | |
| 28 | struct X : M, N, P { // ... |
Fariborz Jahanian | 08d99e9 | 2009-08-10 18:34:26 +0000 | [diff] [blame^] | 29 | X() : f1(1.0), d1(2.0), i1(3), name("HELLO"), bf1(0xff), bf2(0xabcd) {} |
Fariborz Jahanian | cefe592 | 2009-08-08 23:32:22 +0000 | [diff] [blame] | 30 | P p0; |
| 31 | void pr() { printf("iM = %d iN = %d, m1.iM = %d\n", iM, iN, m1.iM); |
Fariborz Jahanian | 08d99e9 | 2009-08-10 18:34:26 +0000 | [diff] [blame^] | 32 | printf("im = %d p0.iP = %d, p1.iP = %d\n", iP, p0.iP, p1.iP); |
| 33 | printf("f1 = %f d1 = %f i1 = %d name(%s) \n", f1, d1, i1, name); |
| 34 | printf("bf1 = %x bf2 = %x\n", bf1, bf2); |
| 35 | } |
Fariborz Jahanian | cefe592 | 2009-08-08 23:32:22 +0000 | [diff] [blame] | 36 | M m1; |
| 37 | P p1; |
Fariborz Jahanian | 08d99e9 | 2009-08-10 18:34:26 +0000 | [diff] [blame^] | 38 | float f1; |
| 39 | double d1; |
| 40 | int i1; |
| 41 | const char *name; |
| 42 | unsigned bf1 : 8; |
| 43 | unsigned bf2 : 16; |
Fariborz Jahanian | cefe592 | 2009-08-08 23:32:22 +0000 | [diff] [blame] | 44 | }; |
| 45 | |
| 46 | int main() |
| 47 | { |
| 48 | X a; |
| 49 | X b(a); |
| 50 | b.pr(); |
| 51 | X x; |
| 52 | X c(x); |
| 53 | c.pr(); |
| 54 | } |
Fariborz Jahanian | cefe592 | 2009-08-08 23:32:22 +0000 | [diff] [blame] | 55 | // CHECK-LP64: .globl __ZN1XC1ERK1X |
| 56 | // CHECK-LP64: .weak_definition __ZN1XC1ERK1X |
| 57 | // CHECK-LP64: __ZN1XC1ERK1X: |
Fariborz Jahanian | cefe592 | 2009-08-08 23:32:22 +0000 | [diff] [blame] | 58 | |
| 59 | // CHECK-LP32: .globl __ZN1XC1ERK1X |
| 60 | // CHECK-LP32: .weak_definition __ZN1XC1ERK1X |
| 61 | // CHECK-LP32: __ZN1XC1ERK1X: |