Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -emit-llvm -o %t |
Fariborz Jahanian | c238a79 | 2009-07-30 00:10:25 +0000 | [diff] [blame] | 2 | |
| 3 | extern "C" int printf(...); |
| 4 | |
| 5 | struct M { |
| 6 | M(int i){ iM = i; } |
| 7 | int iM; |
| 8 | void MPR() { printf("iM = %d\n", iM); } |
| 9 | |
| 10 | }; |
| 11 | |
| 12 | struct Q { |
| 13 | Q(int i){ iQ = i; } |
| 14 | int iQ; |
| 15 | void QPR() { printf("iQ = %d\n", iQ); } |
| 16 | }; |
| 17 | |
| 18 | struct IQ { |
| 19 | IQ(int i) { iIQ = i; } |
| 20 | void IQPR() { printf("iIQ = %d\n", iIQ); } |
| 21 | int iIQ; |
| 22 | }; |
| 23 | |
| 24 | struct L : IQ { |
| 25 | L(int i) : IQ(i+100) { iL = i; } |
| 26 | int iL; |
| 27 | }; |
| 28 | |
| 29 | struct P : Q, L { |
| 30 | P(int i) : Q(i+100), L(i+200) { iP = i; } |
| 31 | int iP; |
| 32 | void PPR() { printf("iP = %d\n", iP); } |
| 33 | }; |
| 34 | |
| 35 | |
| 36 | struct N : M,P { |
| 37 | N() : M(100), P(200) {} |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 38 | void PR() { |
| 39 | this->MPR(); this->PPR(); this->QPR(); |
| 40 | IQPR(); |
| 41 | printf("iM = %d\n", iM); |
| 42 | printf("iP = %d\n", iP); |
| 43 | printf("iQ = %d\n", iQ); |
| 44 | printf("iL = %d\n", iL); |
| 45 | printf("iIQ = %d\n", iIQ); |
| 46 | } |
Fariborz Jahanian | c238a79 | 2009-07-30 00:10:25 +0000 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | int main() { |
| 50 | N n1; |
| 51 | n1.PR(); |
| 52 | } |