]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGenCXX/copy-constructor-elim.cpp
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
[FreeBSD/FreeBSD.git] / test / CodeGenCXX / copy-constructor-elim.cpp
1 // RUN: %clang_cc1 -emit-llvm -o %t %s
2 // RUN: not grep "_ZN1CC1ERK1C" %t
3 // RUN: not grep "_ZN1SC1ERK1S" %t
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 }