Anders Carlsson | 202e42b | 2010-01-27 03:03:08 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -O2 -o - | FileCheck %s |
2 | static int count = 0; | ||||
Fariborz Jahanian | 6b48720 | 2009-08-20 23:33:31 +0000 | [diff] [blame] | 3 | |
Fariborz Jahanian | 0880bac | 2009-08-17 19:04:50 +0000 | [diff] [blame] | 4 | struct S { |
Anders Carlsson | 202e42b | 2010-01-27 03:03:08 +0000 | [diff] [blame] | 5 | S() { count++; } |
6 | ~S() { count--; } | ||||
Fariborz Jahanian | 0880bac | 2009-08-17 19:04:50 +0000 | [diff] [blame] | 7 | }; |
8 | |||||
9 | struct P { | ||||
Anders Carlsson | 202e42b | 2010-01-27 03:03:08 +0000 | [diff] [blame] | 10 | P() { count++; } |
11 | ~P() { count--; } | ||||
Fariborz Jahanian | 0880bac | 2009-08-17 19:04:50 +0000 | [diff] [blame] | 12 | }; |
13 | |||||
Anders Carlsson | 202e42b | 2010-01-27 03:03:08 +0000 | [diff] [blame] | 14 | struct Q { |
15 | Q() { count++; } | ||||
16 | ~Q() { count--; } | ||||
17 | }; | ||||
18 | |||||
19 | struct M : Q, P { | ||||
Fariborz Jahanian | 0880bac | 2009-08-17 19:04:50 +0000 | [diff] [blame] | 20 | S s; |
Fariborz Jahanian | 0880bac | 2009-08-17 19:04:50 +0000 | [diff] [blame] | 21 | Q q; |
Anders Carlsson | 202e42b | 2010-01-27 03:03:08 +0000 | [diff] [blame] | 22 | P p; |
23 | P p_arr[3]; | ||||
24 | Q q_arr[2][3]; | ||||
Fariborz Jahanian | 0880bac | 2009-08-17 19:04:50 +0000 | [diff] [blame] | 25 | }; |
Anders Carlsson | 202e42b | 2010-01-27 03:03:08 +0000 | [diff] [blame] | 26 | |
27 | // CHECK: define i32 @_Z1fv() nounwind | ||||
28 | int f() { | ||||
29 | { | ||||
30 | count = 1; | ||||
31 | M a; | ||||
32 | } | ||||
Fariborz Jahanian | 0880bac | 2009-08-17 19:04:50 +0000 | [diff] [blame] | 33 | |
Anders Carlsson | 202e42b | 2010-01-27 03:03:08 +0000 | [diff] [blame] | 34 | // CHECK: ret i32 1 |
35 | return count; | ||||
36 | } |