summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/rval-references-examples.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-01-21 19:38:21 +0000
committerDouglas Gregor <dgregor@apple.com>2011-01-21 19:38:21 +0000
commitf282a76fab30db288d35280c8ad2954db8c9f9b5 (patch)
tree8f535567924d49fda3d7e7287befb239b0a01da6 /clang/test/SemaCXX/rval-references-examples.cpp
parent2f2435d026fdc8259048fdd03156ec6f119d9d9c (diff)
downloadbcm5719-llvm-f282a76fab30db288d35280c8ad2954db8c9f9b5.tar.gz
bcm5719-llvm-f282a76fab30db288d35280c8ad2954db8c9f9b5.zip
Implement the preference for move-construction over copy-construction
when returning an NRVO candidate expression. For example, this properly picks the move constructor when dealing with code such as MoveOnlyType f() { MoveOnlyType mot; return mot; } The previously-XFAIL'd rvalue-references test case now works, and has been moved into the appropriate paragraph-specific test case. llvm-svn: 123992
Diffstat (limited to 'clang/test/SemaCXX/rval-references-examples.cpp')
-rw-r--r--clang/test/SemaCXX/rval-references-examples.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/rval-references-examples.cpp b/clang/test/SemaCXX/rval-references-examples.cpp
index 1cde5854ba2..778924d6575 100644
--- a/clang/test/SemaCXX/rval-references-examples.cpp
+++ b/clang/test/SemaCXX/rval-references-examples.cpp
@@ -59,7 +59,7 @@ unique_ptr<T> make_unique_ptr(Args &&...args) {
template<typename T> void accept_unique_ptr(unique_ptr<T>); // expected-note{{passing argument to parameter here}}
-void test_unique_ptr() {
+unique_ptr<int> test_unique_ptr() {
// Simple construction
unique_ptr<int> p;
unique_ptr<int> p1(new int);
@@ -85,4 +85,6 @@ void test_unique_ptr() {
// Implicit copies (failures);
accept_unique_ptr(p); // expected-error{{call to deleted constructor of 'unique_ptr<int>'}}
+
+ return p;
}
OpenPOWER on IntegriCloud