xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/copy-constructor-elim.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple %ms_abi_triple -emit-llvm -o - %s | FileCheck %s -check-prefix MS
3*0a6a1f1dSLionel Sambuc // CHECK-NOT: _ZN1CC1ERK1C
4*0a6a1f1dSLionel Sambuc // CHECK-NOT: _ZN1SC1ERK1S
5*0a6a1f1dSLionel Sambuc // MS-NOT: ?0C@@QAE@ABV0
6*0a6a1f1dSLionel Sambuc // MS-NOT: ?0S@@QAE@ABV0
7f4a2713aSLionel Sambuc 
8f4a2713aSLionel Sambuc extern "C" int printf(...);
9f4a2713aSLionel Sambuc 
10f4a2713aSLionel Sambuc 
11f4a2713aSLionel Sambuc struct C {
CC12f4a2713aSLionel Sambuc   C() : iC(6) {printf("C()\n"); }
CC13f4a2713aSLionel Sambuc   C(const C& c) { printf("C(const C& c)\n"); }
14f4a2713aSLionel Sambuc   int iC;
15f4a2713aSLionel Sambuc };
16f4a2713aSLionel Sambuc 
foo()17f4a2713aSLionel Sambuc C foo() {
18f4a2713aSLionel Sambuc   return C();
19f4a2713aSLionel Sambuc };
20f4a2713aSLionel Sambuc 
21f4a2713aSLionel Sambuc class X { // ...
22f4a2713aSLionel Sambuc public:
X(int)23f4a2713aSLionel Sambuc   X(int) {}
X(const X &,int i=1,int j=2,C c=foo ())24f4a2713aSLionel Sambuc   X(const X&, int i = 1, int j = 2, C c = foo()) {
25f4a2713aSLionel Sambuc     printf("X(const X&, %d, %d, %d)\n", i, j, c.iC);
26f4a2713aSLionel Sambuc   }
27f4a2713aSLionel Sambuc };
28f4a2713aSLionel Sambuc 
29f4a2713aSLionel Sambuc 
30f4a2713aSLionel Sambuc struct S {
31f4a2713aSLionel Sambuc   S();
32f4a2713aSLionel Sambuc };
33f4a2713aSLionel Sambuc 
S()34f4a2713aSLionel Sambuc S::S() { printf("S()\n"); }
35f4a2713aSLionel Sambuc 
Call(S)36f4a2713aSLionel Sambuc void Call(S) {};
37f4a2713aSLionel Sambuc 
main()38f4a2713aSLionel Sambuc int main() {
39f4a2713aSLionel Sambuc   X a(1);
40f4a2713aSLionel Sambuc   X b(a, 2);
41f4a2713aSLionel Sambuc   X c = b;
42f4a2713aSLionel Sambuc   X d(a, 5, 6);
43f4a2713aSLionel Sambuc   S s;
44f4a2713aSLionel Sambuc   Call(s);
45f4a2713aSLionel Sambuc }
46