[libcxx] r294158 - [libcxx] [test] Fix Clang -Wpessimizing-move "moving a temporary object prevents copy elision".
Stephan T. Lavavej via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 5 14:48:07 PST 2017
Author: stl_msft
Date: Sun Feb 5 16:48:07 2017
New Revision: 294158
URL: http://llvm.org/viewvc/llvm-project?rev=294158&view=rev
Log:
[libcxx] [test] Fix Clang -Wpessimizing-move "moving a temporary object prevents copy elision".
N4618 30.6.6 [futures.unique_future]/12 declares "shared_future<R> share() noexcept;".
Fixes D29139.
Modified:
libcxx/trunk/test/std/thread/futures/futures.unique_future/share.pass.cpp
Modified: libcxx/trunk/test/std/thread/futures/futures.unique_future/share.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/futures/futures.unique_future/share.pass.cpp?rev=294158&r1=294157&r2=294158&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/futures/futures.unique_future/share.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/futures/futures.unique_future/share.pass.cpp Sun Feb 5 16:48:07 2017
@@ -26,7 +26,7 @@ int main()
std::promise<T> p;
std::future<T> f0 = p.get_future();
static_assert( noexcept(f0.share()), "");
- std::shared_future<T> f = std::move(f0.share());
+ std::shared_future<T> f = f0.share();
assert(!f0.valid());
assert(f.valid());
}
@@ -34,7 +34,7 @@ int main()
typedef int T;
std::future<T> f0;
static_assert( noexcept(f0.share()), "");
- std::shared_future<T> f = std::move(f0.share());
+ std::shared_future<T> f = f0.share();
assert(!f0.valid());
assert(!f.valid());
}
@@ -43,7 +43,7 @@ int main()
std::promise<T> p;
std::future<T> f0 = p.get_future();
static_assert( noexcept(f0.share()), "");
- std::shared_future<T> f = std::move(f0.share());
+ std::shared_future<T> f = f0.share();
assert(!f0.valid());
assert(f.valid());
}
@@ -51,7 +51,7 @@ int main()
typedef int& T;
std::future<T> f0;
static_assert( noexcept(f0.share()), "");
- std::shared_future<T> f = std::move(f0.share());
+ std::shared_future<T> f = f0.share();
assert(!f0.valid());
assert(!f.valid());
}
@@ -60,7 +60,7 @@ int main()
std::promise<T> p;
std::future<T> f0 = p.get_future();
static_assert( noexcept(f0.share()), "");
- std::shared_future<T> f = std::move(f0.share());
+ std::shared_future<T> f = f0.share();
assert(!f0.valid());
assert(f.valid());
}
@@ -68,7 +68,7 @@ int main()
typedef void T;
std::future<T> f0;
static_assert( noexcept(f0.share()), "");
- std::shared_future<T> f = std::move(f0.share());
+ std::shared_future<T> f = f0.share();
assert(!f0.valid());
assert(!f.valid());
}
More information about the cfe-commits
mailing list