blob: 3fafe6176990f8f348ae00e77c8a9084be57f299 [file] [log] [blame]
Fariborz Jahanian7fe5d722009-08-28 22:04:50 +00001// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s &&
2// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s &&
3// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s &&
4// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s &&
5// RUN: true
6
7extern "C" int printf(...);
8
9class X { // ...
10public:
11 X(int) : iX(2), fX(2.3) , name("HELLO\n") { }
12
13 X(const char* arg, int ix=0) { iX = ix; fX = 6.0; name = arg+ix; }
14 X(): iX(100), fX(1.2) {}
15 int iX;
16 float fX;
17 const char *name;
18 void pr(void) {
19 printf("iX = %d fX = %f name = %s\n", iX, fX, name);
20 }
21};
22
23void g(X arg) {
24 arg.pr();
25}
26
27void f(X arg) {
28
29 X a = 1; // a = X(1)
30
31 a.pr();
32
33 X b = "Jessie"; // b=X("Jessie",0)
34
35 b.pr();
36
37
38 a = 2; // a = X(2)
39
40 a.pr();
41
42}
43
44
45int main()
46{
47 X x;
48 f(x);
49 g(3); // g(X(3))
50}
51
52// CHECK-LP64: call __ZN1XC1Ei
53// CHECK-LP64: call __ZN1XC1EPKci
54// CHECK-LP64: call __ZN1XC1Ev
55
56// CHECK-LP32: call L__ZN1XC1Ei
57// CHECK-LP32: call L__ZN1XC1EPKci
58// CHECK-LP32: call L__ZN1XC1Ev