xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/constructor-for-array-members.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | \
2*0a6a1f1dSLionel Sambuc // RUN: FileCheck %s
3*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -emit-llvm %s -o - | \
4*0a6a1f1dSLionel Sambuc // RUN: FileCheck %s
5f4a2713aSLionel Sambuc 
6f4a2713aSLionel Sambuc extern "C" int printf(...);
7f4a2713aSLionel Sambuc 
8f4a2713aSLionel Sambuc int i = 1234;
9f4a2713aSLionel Sambuc float vf = 1.00;
10f4a2713aSLionel Sambuc 
11f4a2713aSLionel Sambuc struct S {
SS12f4a2713aSLionel Sambuc   S() : iS(i++), f1(vf++) {printf("S::S()\n");}
~SS13f4a2713aSLionel Sambuc   ~S(){printf("S::~S(iS = %d  f1 = %f)\n", iS, f1); }
14f4a2713aSLionel Sambuc   int iS;
15f4a2713aSLionel Sambuc   float f1;
16f4a2713aSLionel Sambuc };
17f4a2713aSLionel Sambuc 
18f4a2713aSLionel Sambuc struct M {
19f4a2713aSLionel Sambuc   double dM;
20f4a2713aSLionel Sambuc   S ARR_S[3];
prM21f4a2713aSLionel Sambuc   void pr() {
22f4a2713aSLionel Sambuc     for (int i = 0; i < 3; i++)
23f4a2713aSLionel Sambuc      printf("ARR_S[%d].iS = %d ARR_S[%d].f1 = %f\n", i, ARR_S[i].iS, i, ARR_S[i].f1);
24f4a2713aSLionel Sambuc 
25f4a2713aSLionel Sambuc     for (int i = 0; i < 2; i++)
26f4a2713aSLionel Sambuc       for (int j = 0; j < 3; j++)
27f4a2713aSLionel Sambuc         for (int k = 0; k < 4; k++)
28f4a2713aSLionel Sambuc            printf("MULTI_ARR[%d][%d][%d].iS = %d MULTI_ARR[%d][%d][%d].f1 = %f\n",
29f4a2713aSLionel Sambuc                   i,j,k, MULTI_ARR[i][j][k].iS, i,j,k, MULTI_ARR[i][j][k].f1);
30f4a2713aSLionel Sambuc 
31f4a2713aSLionel Sambuc   }
32f4a2713aSLionel Sambuc 
33f4a2713aSLionel Sambuc  S MULTI_ARR[2][3][4];
34f4a2713aSLionel Sambuc };
35f4a2713aSLionel Sambuc 
main()36f4a2713aSLionel Sambuc int main() {
37f4a2713aSLionel Sambuc   M m1;
38f4a2713aSLionel Sambuc   m1.pr();
39f4a2713aSLionel Sambuc }
40f4a2713aSLionel Sambuc 
41*0a6a1f1dSLionel Sambuc // CHECK: call void @_ZN1SC1Ev
42