summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/references.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-10-18 23:09:21 +0000
committerAnders Carlsson <andersca@mac.com>2009-10-18 23:09:21 +0000
commit69c2c4becc7a1b74c2d6a4b621bd9e908f7fd6a8 (patch)
tree8a1baadeb82ba1d9475c1c8b09aebe43b1b6d314 /clang/test/CodeGenCXX/references.cpp
parent7d2019f9b3dfd49584d4f59bd76ed6a6e117068e (diff)
downloadbcm5719-llvm-69c2c4becc7a1b74c2d6a4b621bd9e908f7fd6a8.tar.gz
bcm5719-llvm-69c2c4becc7a1b74c2d6a4b621bd9e908f7fd6a8.zip
When binding a reference to a temporary, it's important that other temporaries created as on the RHS are destroyed before emitting the dtor for the temporary.
llvm-svn: 84451
Diffstat (limited to 'clang/test/CodeGenCXX/references.cpp')
-rw-r--r--clang/test/CodeGenCXX/references.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/references.cpp b/clang/test/CodeGenCXX/references.cpp
index 32d46b3e104..682aab310d0 100644
--- a/clang/test/CodeGenCXX/references.cpp
+++ b/clang/test/CodeGenCXX/references.cpp
@@ -107,3 +107,26 @@ void h() {
const C& c = D();
}
+namespace T {
+ struct A {
+ A();
+ ~A();
+ };
+
+ struct B {
+ B();
+ ~B();
+ A f();
+ };
+
+ void f() {
+ // CHECK: call void @_ZN1T1BC1Ev
+ // CHECK: call void @_ZN1T1B1fEv
+ // CHECK: call void @_ZN1T1BD1Ev
+ const A& a = B().f();
+ // CHECK: call void @_ZN1T1fEv
+ f();
+ // CHECK: call void @_ZN1T1AD1Ev
+ }
+}
+
OpenPOWER on IntegriCloud