xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/constructor-default-arg.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | \
2*0a6a1f1dSLionel Sambuc // RUN: FileCheck %s
3*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -emit-llvm %s -o - | \
4*0a6a1f1dSLionel Sambuc // RUN: FileCheck %s
5f4a2713aSLionel Sambuc 
6f4a2713aSLionel Sambuc extern "C" int printf(...);
7f4a2713aSLionel Sambuc 
8f4a2713aSLionel Sambuc 
9f4a2713aSLionel Sambuc struct C {
CC10f4a2713aSLionel Sambuc   C() : iC(6) {}
11f4a2713aSLionel Sambuc   int iC;
12f4a2713aSLionel Sambuc };
13f4a2713aSLionel Sambuc 
foo()14f4a2713aSLionel Sambuc int foo() {
15f4a2713aSLionel Sambuc   return 6;
16f4a2713aSLionel Sambuc };
17f4a2713aSLionel Sambuc 
18f4a2713aSLionel Sambuc class X { // ...
19f4a2713aSLionel Sambuc public:
X(int)20f4a2713aSLionel Sambuc   X(int) {}
X(const X &,int i=1,int j=2,int k=foo ())21f4a2713aSLionel Sambuc   X(const X&, int i = 1, int j = 2, int k = foo()) {
22f4a2713aSLionel Sambuc     printf("X(const X&, %d, %d, %d)\n", i, j, k);
23f4a2713aSLionel Sambuc   }
24f4a2713aSLionel Sambuc };
25f4a2713aSLionel Sambuc 
main()26f4a2713aSLionel Sambuc int main() {
27f4a2713aSLionel Sambuc   X a(1);
28f4a2713aSLionel Sambuc   X b(a, 2);
29f4a2713aSLionel Sambuc   X c = b;
30f4a2713aSLionel Sambuc   X d(a, 5, 6);
31f4a2713aSLionel Sambuc }
32f4a2713aSLionel Sambuc 
33*0a6a1f1dSLionel Sambuc // CHECK: call void @_ZN1XC1ERKS_iii
34*0a6a1f1dSLionel Sambuc // CHECK: call void @_ZN1XC1ERKS_iii
35*0a6a1f1dSLionel Sambuc // CHECK: call void @_ZN1XC1ERKS_iii
36