blob: fac5cc01f6b72aaa97c4aa6a8718bd1514fce478 [file] [log] [blame]
Anders Carlsson202e42b2010-01-27 03:03:08 +00001// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -O2 -o - | FileCheck %s
2static int count = 0;
Fariborz Jahanian6b487202009-08-20 23:33:31 +00003
Fariborz Jahanian0880bac2009-08-17 19:04:50 +00004struct S {
Anders Carlsson202e42b2010-01-27 03:03:08 +00005 S() { count++; }
6 ~S() { count--; }
Fariborz Jahanian0880bac2009-08-17 19:04:50 +00007};
8
9struct P {
Anders Carlsson202e42b2010-01-27 03:03:08 +000010 P() { count++; }
11 ~P() { count--; }
Fariborz Jahanian0880bac2009-08-17 19:04:50 +000012};
13
Anders Carlsson202e42b2010-01-27 03:03:08 +000014struct Q {
15 Q() { count++; }
16 ~Q() { count--; }
17};
18
19struct M : Q, P {
Fariborz Jahanian0880bac2009-08-17 19:04:50 +000020 S s;
Fariborz Jahanian0880bac2009-08-17 19:04:50 +000021 Q q;
Anders Carlsson202e42b2010-01-27 03:03:08 +000022 P p;
23 P p_arr[3];
24 Q q_arr[2][3];
Fariborz Jahanian0880bac2009-08-17 19:04:50 +000025};
Anders Carlsson202e42b2010-01-27 03:03:08 +000026
27// CHECK: define i32 @_Z1fv() nounwind
28int f() {
29 {
30 count = 1;
31 M a;
32 }
Fariborz Jahanian0880bac2009-08-17 19:04:50 +000033
Anders Carlsson202e42b2010-01-27 03:03:08 +000034 // CHECK: ret i32 1
35 return count;
36}