blob: ef5900e59c114d71349478cf654e635827c61ca9 [file] [log] [blame]
Galina Kistanova0ccb31c2011-06-03 22:24:54 +00001// REQUIRES: x86-registered-target,x86-64-registered-target
Daniel Dunbara5728872009-12-15 20:14:24 +00002// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s
Daniel Dunbar4fcfde42009-11-08 01:45:36 +00003// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
Daniel Dunbara5728872009-12-15 20:14:24 +00004// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s
Daniel Dunbar4fcfde42009-11-08 01:45:36 +00005// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
Fariborz Jahanian995d2812009-08-20 01:01:06 +00006
7extern "C" int printf(...);
8
9int i = 1234;
10float vf = 1.00;
11
12struct S {
13 S() : iS(i++), f1(vf++) {printf("S::S()\n");}
Fariborz Jahanian1c536bf2009-08-20 23:02:58 +000014 ~S(){printf("S::~S(iS = %d f1 = %f)\n", iS, f1); }
Fariborz Jahanian995d2812009-08-20 01:01:06 +000015 int iS;
16 float f1;
17};
18
19struct 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
37int main() {
Mike Stump1eb44332009-09-09 15:08:12 +000038 M m1;
39 m1.pr();
Fariborz Jahanian995d2812009-08-20 01:01:06 +000040}
41
Sean Callanan3b299012009-12-18 00:04:09 +000042// CHECK-LP64: callq __ZN1SC1Ev
Fariborz Jahanian995d2812009-08-20 01:01:06 +000043
Chris Lattner398e6b92010-09-22 06:09:31 +000044// CHECK-LP32: calll L__ZN1SC1Ev