1 // REQUIRES: x86-registered-target,x86-64-registered-target
2 // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s
3 // RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s
4 // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s
5 // RUN: FileCheck -check-prefix CHECK-LP32 --input-file=%t-32.s %s
6 
7 extern "C" int printf(...);
8 
9 class X { // ...
10 public:
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 
23 void g(X arg) {
24   arg.pr();
25 }
26 
27 void f(X arg) {
28   X a = 1;        // a = X(1)
29 
30   a.pr();
31 
32   X b = "Jessie"; //  b=X("Jessie",0)
33 
34   b.pr();
35 
36 
37   a = 2;          // a = X(2)
38 
39   a.pr();
40 }
41 
42 
43 int main() {
44   X x;
45   f(x);
46   g(3);           // g(X(3))
47 }
48 
49 // CHECK-LP64: callq    __ZN1XC1Ei
50 // CHECK-LP64: callq    __ZN1XC1EPKci
51 // CHECK-LP64: callq    __ZN1XC1Ev
52 
53 // CHECK-LP32: calll     L__ZN1XC1Ei
54 // CHECK-LP32: calll     L__ZN1XC1EPKci
55 // CHECK-LP32: calll     L__ZN1XC1Ev
56