1 // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | \
2 // RUN: FileCheck %s
3 // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -emit-llvm %s -o - | \
4 // RUN: FileCheck %s
5
6 extern "C" int printf(...);
7
8 class X { // ...
9 public:
X(int)10 X(int) : iX(2), fX(2.3) , name("HELLO\n") { }
11
X(const char * arg,int ix=0)12 X(const char* arg, int ix=0) { iX = ix; fX = 6.0; name = arg+ix; }
X()13 X(): iX(100), fX(1.2) {}
14 int iX;
15 float fX;
16 const char *name;
pr(void)17 void pr(void) {
18 printf("iX = %d fX = %f name = %s\n", iX, fX, name);
19 }
20 };
21
g(X arg)22 void g(X arg) {
23 arg.pr();
24 }
25
f(X arg)26 void f(X arg) {
27 X a = 1; // a = X(1)
28
29 a.pr();
30
31 X b = "Jessie"; // b=X("Jessie",0)
32
33 b.pr();
34
35
36 a = 2; // a = X(2)
37
38 a.pr();
39 }
40
41
main()42 int main() {
43 X x;
44 f(x);
45 g(3); // g(X(3))
46 }
47
48 // CHECK: call void @_ZN1XC1Ei
49 // CHECK: call void @_ZN1XC1EPKci
50 // CHECK: call void @_ZN1XC1Ev
51