global-array-destruction.cpp revision 88f4280f6b60edcbdea6a38a3da8b17d66473ad6
1// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
2// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
3
4extern "C" int printf(...);
5
6int count;
7
8struct S {
9  S() : iS(++count) { printf("S::S(%d)\n", iS); }
10  ~S() { printf("S::~S(%d)\n", iS); }
11  int iS;
12};
13
14
15S arr[2][1];
16S s1;
17S arr1[3];
18static S sarr[4];
19
20int main () {}
21S arr2[2];
22static S sarr1[4];
23S s2;
24S arr3[3];
25
26// CHECK-LP64: call     ___cxa_atexit
27// CHECK-LP64: call     ___cxa_atexit
28// CHECK-LP64: call     ___cxa_atexit
29// CHECK-LP64: call     ___cxa_atexit
30// CHECK-LP64: call     ___cxa_atexit
31// CHECK-LP64: call     ___cxa_atexit
32// CHECK-LP64: call     ___cxa_atexit
33// CHECK-LP64: call     ___cxa_atexit
34