blob: b981da497364161f3398df6ad0f906795c68e568 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
Daniel Dunbar4fcfde42009-11-08 01:45:36 +00002// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
Daniel Dunbara5728872009-12-15 20:14:24 +00003// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
Daniel Dunbar4fcfde42009-11-08 01:45:36 +00004// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
Fariborz Jahanian995d2812009-08-20 01:01:06 +00005
6extern "C" int printf(...);
7
8int i = 1234;
9float vf = 1.00;
10
11struct S {
12 S() : iS(i++), f1(vf++) {printf("S::S()\n");}
Fariborz Jahanian1c536bf2009-08-20 23:02:58 +000013 ~S(){printf("S::~S(iS = %d f1 = %f)\n", iS, f1); }
Fariborz Jahanian995d2812009-08-20 01:01:06 +000014 int iS;
15 float f1;
16};
17
18struct 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
36int main() {
Mike Stump1eb44332009-09-09 15:08:12 +000037 M m1;
38 m1.pr();
Fariborz Jahanian995d2812009-08-20 01:01:06 +000039}
40
Sean Callanan3b299012009-12-18 00:04:09 +000041// CHECK-LP64: callq __ZN1SC1Ev
Fariborz Jahanian995d2812009-08-20 01:01:06 +000042
Mike Stump1eb44332009-09-09 15:08:12 +000043// CHECK-LP32: call L__ZN1SC1Ev