[PATCH] D29139: [libcxx] [test] Fix Clang -Wpessimizing-move "moving a temporary object prevents copy elision".
Stephan T. Lavavej via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 25 10:37:58 PST 2017
STL_MSFT created this revision.
[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;".
https://reviews.llvm.org/D29139
Files:
test/std/thread/futures/futures.unique_future/share.pass.cpp
Index: test/std/thread/futures/futures.unique_future/share.pass.cpp
===================================================================
--- test/std/thread/futures/futures.unique_future/share.pass.cpp
+++ test/std/thread/futures/futures.unique_future/share.pass.cpp
@@ -26,49 +26,49 @@
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());
}
{
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());
}
{
typedef int& T;
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());
}
{
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());
}
{
typedef void T;
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());
}
{
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());
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29139.85781.patch
Type: text/x-patch
Size: 2077 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170125/df880520/attachment.bin>
More information about the cfe-commits
mailing list