Implement P0516: 'Clarify That shared_future’s Copy Operations have Wide Contracts...
authorMarshall Clow <mclow.lists@gmail.com>
Mon, 14 Nov 2016 19:58:05 +0000 (19:58 +0000)
committerMarshall Clow <mclow.lists@gmail.com>
Mon, 14 Nov 2016 19:58:05 +0000 (19:58 +0000)
llvm-svn: 286877

libcxx/include/future
libcxx/test/std/thread/futures/futures.shared_future/copy_assign.pass.cpp
libcxx/test/std/thread/futures/futures.shared_future/copy_ctor.pass.cpp
libcxx/www/cxx1z_status.html

index 656f9c7..ce22c1e 100644 (file)
@@ -2374,7 +2374,7 @@ public:
     _LIBCPP_INLINE_VISIBILITY
     shared_future() _NOEXCEPT : __state_(nullptr) {}
     _LIBCPP_INLINE_VISIBILITY
-    shared_future(const shared_future& __rhs) : __state_(__rhs.__state_)
+    shared_future(const shared_future& __rhs)  _NOEXCEPT : __state_(__rhs.__state_)
         {if (__state_) __state_->__add_shared();}
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     _LIBCPP_INLINE_VISIBILITY
@@ -2385,7 +2385,7 @@ public:
         {__rhs.__state_ = nullptr;}
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
     ~shared_future();
-    shared_future& operator=(const shared_future& __rhs);
+    shared_future& operator=(const shared_future& __rhs) _NOEXCEPT;
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     _LIBCPP_INLINE_VISIBILITY
     shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
@@ -2429,7 +2429,7 @@ shared_future<_Rp>::~shared_future()
 
 template <class _Rp>
 shared_future<_Rp>&
-shared_future<_Rp>::operator=(const shared_future& __rhs)
+shared_future<_Rp>::operator=(const shared_future& __rhs) _NOEXCEPT
 {
     if (__rhs.__state_)
         __rhs.__state_->__add_shared();
index 3f9e945..abb9928 100644 (file)
 // class shared_future<R>
 
 // shared_future& operator=(const shared_future& rhs);
+// noexcept in C++17
 
 #include <future>
 #include <cassert>
 
+#include "test_macros.h"
+
 int main()
 {
     {
@@ -27,6 +30,9 @@ int main()
         std::shared_future<T> f0 = p.get_future();
         std::shared_future<T> f;
         f = f0;
+#if TEST_STD_VER > 14
+        static_assert(noexcept(f = f0), "" );
+#endif
         assert(f0.valid());
         assert(f.valid());
     }
index 1da0880..2b66331 100644 (file)
 // class shared_future<R>
 
 // shared_future(const shared_future& rhs);
+// noexcept in C++17
 
 #include <future>
 #include <cassert>
 
+#include "test_macros.h"
+
 int main()
 {
     {
@@ -26,6 +29,9 @@ int main()
         std::promise<T> p;
         std::shared_future<T> f0 = p.get_future();
         std::shared_future<T> f = f0;
+#if TEST_STD_VER > 14
+        static_assert(noexcept(std::shared_future<T>{f0}), "" );
+#endif
         assert(f0.valid());
         assert(f.valid());
     }
index f08127c..e998037 100644 (file)
        <tr><td><a href="http://wg21.link/P0509R1">P0509R1</a></td><td>LWG</td><td>Updating “Restrictions on exception handling”</td><td>Issaquah</td><td></td><td></td></tr>
        <tr><td><a href="http://wg21.link/P0510R0">P0510R0</a></td><td>LWG</td><td>Disallowing references, incomplete types, arrays, and empty variants</td><td>Issaquah</td><td></td><td></td></tr>
        <tr><td><a href="http://wg21.link/P0513R0">P0513R0</a></td><td>LWG</td><td>Poisoning the Hash</td><td>Issaquah</td><td></td><td></td></tr>
-       <tr><td><a href="http://wg21.link/P0516R0">P0516R0</a></td><td>LWG</td><td>Clarify That shared_future’s Copy Operations have Wide Contracts</td><td>Issaquah</td><td></td><td></td></tr>
+       <tr><td><a href="http://wg21.link/P0516R0">P0516R0</a></td><td>LWG</td><td>Clarify That shared_future’s Copy Operations have Wide Contracts</td><td>Issaquah</td><td>Complete</td><td>4.0</td></tr>
        <tr><td><a href="http://wg21.link/P0517R0">P0517R0</a></td><td>LWG</td><td>Make future_error Constructible</td><td>Issaquah</td><td>Complete</td><td>4.0</td></tr>
        <tr><td><a href="http://wg21.link/P0521R0">P0521R0</a></td><td>LWG</td><td>Proposed Resolution for CA 14 (shared_ptr use_count/unique)</td><td>Issaquah</td><td></td><td></td></tr>