]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGenCXX/constructor-for-array-members.cpp
Vendor import of clang release_30 branch r142614:
[FreeBSD/FreeBSD.git] / test / CodeGenCXX / constructor-for-array-members.cpp
1 // REQUIRES: x86-registered-target,x86-64-registered-target
2 // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s
3 // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
4 // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s
5 // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
6
7 extern "C" int printf(...);
8
9 int i = 1234;
10 float vf = 1.00;
11
12 struct S {
13   S() : iS(i++), f1(vf++) {printf("S::S()\n");}
14   ~S(){printf("S::~S(iS = %d  f1 = %f)\n", iS, f1); }
15   int iS;
16   float f1;
17 };
18
19 struct M {
20   double dM;
21   S ARR_S[3];
22   void pr() {
23     for (int i = 0; i < 3; i++)
24      printf("ARR_S[%d].iS = %d ARR_S[%d].f1 = %f\n", i, ARR_S[i].iS, i, ARR_S[i].f1);
25
26     for (int i = 0; i < 2; i++)
27       for (int j = 0; j < 3; j++)
28         for (int k = 0; k < 4; k++)
29            printf("MULTI_ARR[%d][%d][%d].iS = %d MULTI_ARR[%d][%d][%d].f1 = %f\n", 
30                   i,j,k, MULTI_ARR[i][j][k].iS, i,j,k, MULTI_ARR[i][j][k].f1);
31
32   }
33
34  S MULTI_ARR[2][3][4];
35 };
36
37 int main() {
38   M m1;
39   m1.pr();
40 }
41
42 // CHECK-LP64: callq __ZN1SC1Ev
43
44 // CHECK-LP32: calll L__ZN1SC1Ev