diff options
| author | Anders Carlsson <andersca@mac.com> | 2009-11-13 04:34:45 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2009-11-13 04:34:45 +0000 |
| commit | 78cfaa9e5688debc8a435e2696011ed5c52b5d2e (patch) | |
| tree | 73c99474a4c86834bfb8793fdb0e8929a7482a14 /clang/test/CodeGenCXX/temporaries.cpp | |
| parent | 87f84c1e726b75878a2a3dbb5d424a21da6f34c8 (diff) | |
| download | bcm5719-llvm-78cfaa9e5688debc8a435e2696011ed5c52b5d2e.tar.gz bcm5719-llvm-78cfaa9e5688debc8a435e2696011ed5c52b5d2e.zip | |
Fix two bugs with temporaries:
1. For
A f() {
return A();
}
we were incorrectly calling the A destructor on the returned object.
2. For
void f(A);
void g() {
A a;
f(a);
}
we were incorrectly not calling the copy constructor.
llvm-svn: 87082
Diffstat (limited to 'clang/test/CodeGenCXX/temporaries.cpp')
| -rw-r--r-- | clang/test/CodeGenCXX/temporaries.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/temporaries.cpp b/clang/test/CodeGenCXX/temporaries.cpp index 87ca9ca7d42..4f65e462d42 100644 --- a/clang/test/CodeGenCXX/temporaries.cpp +++ b/clang/test/CodeGenCXX/temporaries.cpp @@ -162,6 +162,29 @@ C::C() // CHECK: call void @_ZN6PR50771BD1Ev } +} + +A f8() { + // CHECK: call void @_ZN1AC1Ev + // CHECK-NOT: call void @_ZN1AD1Ev + return A(); + // CHECK: ret void +} +struct H { + H(); + ~H(); + H(const H&); +}; +void f9(H h) { + // CHECK: call void @_ZN1HC1Ev + // CHECK: call void @_Z2f91H + // CHECK: call void @_ZN1HD1Ev + f9(H()); + + // CHECK: call void @_ZN1HC1ERKS_ + // CHECK: call void @_Z2f91H + // CHECK: call void @_ZN1HD1Ev + f9(h); } |

