summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/temporaries.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-04-25 00:55:24 +0000
committerDouglas Gregor <dgregor@apple.com>2010-04-25 00:55:24 +0000
commitb86cf0c11712fa89f14197f3f0ed862e7b2add84 (patch)
tree11221796e90bf8aa03f15bf189a3bc250ac30cc0 /test/CodeGenCXX/temporaries.cpp
parent8e142ccf1196c9ae31f10f9caa97670e343971e7 (diff)
When copying a temporary object to initialize an entity for which the
temporary needs to be bound, bind the copy object. Otherwise, we won't end up calling the destructor for the copy. Fixes Boost.Optional. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102290 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/temporaries.cpp')
-rw-r--r--test/CodeGenCXX/temporaries.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/CodeGenCXX/temporaries.cpp b/test/CodeGenCXX/temporaries.cpp
index 4aad3c0056..f9a9ed100a 100644
--- a/test/CodeGenCXX/temporaries.cpp
+++ b/test/CodeGenCXX/temporaries.cpp
@@ -301,3 +301,21 @@ namespace PR6648 {
zed(foo);
}
}
+
+namespace UserConvertToValue {
+ struct X {
+ X(int);
+ X(const X&);
+ ~X();
+ };
+
+ void f(X);
+
+ // CHECK: void @_ZN18UserConvertToValue1gEv()
+ void g() {
+ // CHECK: call void @_ZN18UserConvertToValue1XC1Ei
+ // CHECK: call void @_ZN18UserConvertToValue1fENS_1XE
+ // CHECK: call void @_ZN18UserConvertToValue1XD1Ev
+ f(1);
+ }
+}