]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGenCXX/constructor-for-array-members.cpp
Vendor import of clang RELEASE_350/final tag r216957 (effectively, 3.5.0 release):
[FreeBSD/FreeBSD.git] / test / CodeGenCXX / constructor-for-array-members.cpp
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | \
2 // RUN: FileCheck %s
3 // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -emit-llvm %s -o - | \
4 // RUN: FileCheck %s
5
6 extern "C" int printf(...);
7
8 int i = 1234;
9 float vf = 1.00;
10
11 struct S {
12   S() : iS(i++), f1(vf++) {printf("S::S()\n");}
13   ~S(){printf("S::~S(iS = %d  f1 = %f)\n", iS, f1); }
14   int iS;
15   float f1;
16 };
17
18 struct M {
19   double dM;
20   S ARR_S[3];
21   void pr() {
22     for (int i = 0; i < 3; i++)
23      printf("ARR_S[%d].iS = %d ARR_S[%d].f1 = %f\n", i, ARR_S[i].iS, i, ARR_S[i].f1);
24
25     for (int i = 0; i < 2; i++)
26       for (int j = 0; j < 3; j++)
27         for (int k = 0; k < 4; k++)
28            printf("MULTI_ARR[%d][%d][%d].iS = %d MULTI_ARR[%d][%d][%d].f1 = %f\n", 
29                   i,j,k, MULTI_ARR[i][j][k].iS, i,j,k, MULTI_ARR[i][j][k].f1);
30
31   }
32
33  S MULTI_ARR[2][3][4];
34 };
35
36 int main() {
37   M m1;
38   m1.pr();
39 }
40
41 // CHECK: call void @_ZN1SC1Ev