]> git.proxmox.com Git - rustc.git/blob - src/llvm/tools/clang/test/CodeGenCXX/copy-constructor-elim.cpp
Imported Upstream version 0.6
[rustc.git] / src / llvm / tools / clang / test / CodeGenCXX / copy-constructor-elim.cpp
1 // RUN: %clang_cc1 -emit-llvm -o %t %s
2 // RUN: grep "_ZN1CC1ERK1C" %t | count 0
3 // RUN: grep "_ZN1SC1ERK1S" %t | count 0
4
5 extern "C" int printf(...);
6
7
8 struct C {
9 C() : iC(6) {printf("C()\n"); }
10 C(const C& c) { printf("C(const C& c)\n"); }
11 int iC;
12 };
13
14 C foo() {
15 return C();
16 };
17
18 class X { // ...
19 public:
20 X(int) {}
21 X(const X&, int i = 1, int j = 2, C c = foo()) {
22 printf("X(const X&, %d, %d, %d)\n", i, j, c.iC);
23 }
24 };
25
26
27 struct S {
28 S();
29 };
30
31 S::S() { printf("S()\n"); }
32
33 void Call(S) {};
34
35 int main() {
36 X a(1);
37 X b(a, 2);
38 X c = b;
39 X d(a, 5, 6);
40 S s;
41 Call(s);
42 }