opnsense-src/test/CodeGenCXX/default-destructor-synthesis.cpp

37 lines
470 B
C++
Raw Normal View History

2010-02-16 04:31:36 -05:00
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -O2 -o - | FileCheck %s
static int count = 0;
2009-10-14 14:03:49 -04:00
struct S {
2010-02-16 04:31:36 -05:00
S() { count++; }
~S() { count--; }
2009-10-14 14:03:49 -04:00
};
2010-02-16 04:31:36 -05:00
struct P {
P() { count++; }
~P() { count--; }
2009-10-14 14:03:49 -04:00
};
2010-02-16 04:31:36 -05:00
struct Q {
Q() { count++; }
~Q() { count--; }
2009-10-14 14:03:49 -04:00
};
2010-02-16 04:31:36 -05:00
struct M : Q, P {
2009-10-14 14:03:49 -04:00
S s;
Q q;
2010-02-16 04:31:36 -05:00
P p;
P p_arr[3];
Q q_arr[2][3];
2009-10-14 14:03:49 -04:00
};
2010-02-16 04:31:36 -05:00
// CHECK: define i32 @_Z1fv() nounwind
int f() {
{
count = 1;
M a;
}
// CHECK: ret i32 1
return count;
}