[libcxx] r292992 - Implement LWG2556: Wide contract for future::share()

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 24 15:28:25 PST 2017


Author: marshall
Date: Tue Jan 24 17:28:25 2017
New Revision: 292992

URL: http://llvm.org/viewvc/llvm-project?rev=292992&view=rev
Log:
Implement LWG2556: Wide contract for future::share()

Modified:
    libcxx/trunk/include/future
    libcxx/trunk/test/std/thread/futures/futures.unique_future/share.pass.cpp
    libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/future
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/future?rev=292992&r1=292991&r2=292992&view=diff
==============================================================================
--- libcxx/trunk/include/future (original)
+++ libcxx/trunk/include/future Tue Jan 24 17:28:25 2017
@@ -156,7 +156,7 @@ public:
     ~future();
     future& operator=(const future& rhs) = delete;
     future& operator=(future&&) noexcept;
-    shared_future<R> share();
+    shared_future<R> share() noecept;
 
     // retrieving the value
     R get();
@@ -183,7 +183,7 @@ public:
     ~future();
     future& operator=(const future& rhs) = delete;
     future& operator=(future&&) noexcept;
-    shared_future<R&> share();
+    shared_future<R&> share() noexcept;
 
     // retrieving the value
     R& get();
@@ -210,7 +210,7 @@ public:
     ~future();
     future& operator=(const future& rhs) = delete;
     future& operator=(future&&) noexcept;
-    shared_future<void> share();
+    shared_future<void> share() noexcept;
 
     // retrieving the value
     void get();
@@ -1119,7 +1119,7 @@ public:
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
     ~future();
     _LIBCPP_INLINE_VISIBILITY
-    shared_future<_Rp> share();
+    shared_future<_Rp> share() _NOEXCEPT;
 
     // retrieving the value
     _Rp get();
@@ -1222,7 +1222,7 @@ public:
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
     ~future();
     _LIBCPP_INLINE_VISIBILITY
-    shared_future<_Rp&> share();
+    shared_future<_Rp&> share() _NOEXCEPT;
 
     // retrieving the value
     _Rp& get();
@@ -1320,7 +1320,7 @@ public:
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
     ~future();
     _LIBCPP_INLINE_VISIBILITY
-    shared_future<void> share();
+    shared_future<void> share() _NOEXCEPT;
 
     // retrieving the value
     void get();
@@ -2580,7 +2580,7 @@ swap(shared_future<_Rp>& __x, shared_fut
 template <class _Rp>
 inline
 shared_future<_Rp>
-future<_Rp>::share()
+future<_Rp>::share() _NOEXCEPT
 {
     return shared_future<_Rp>(_VSTD::move(*this));
 }
@@ -2588,7 +2588,7 @@ future<_Rp>::share()
 template <class _Rp>
 inline
 shared_future<_Rp&>
-future<_Rp&>::share()
+future<_Rp&>::share() _NOEXCEPT
 {
     return shared_future<_Rp&>(_VSTD::move(*this));
 }
@@ -2597,7 +2597,7 @@ future<_Rp&>::share()
 
 inline
 shared_future<void>
-future<void>::share()
+future<void>::share() _NOEXCEPT
 {
     return shared_future<void>(_VSTD::move(*this));
 }

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=292992&r1=292991&r2=292992&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 Tue Jan 24 17:28:25 2017
@@ -25,6 +25,7 @@ int main()
         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());
         assert(!f0.valid());
         assert(f.valid());
@@ -32,6 +33,7 @@ int main()
     {
         typedef int T;
         std::future<T> f0;
+        static_assert( noexcept(f0.share()), "");
         std::shared_future<T> f = std::move(f0.share());
         assert(!f0.valid());
         assert(!f.valid());
@@ -40,6 +42,7 @@ int main()
         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());
         assert(!f0.valid());
         assert(f.valid());
@@ -47,6 +50,7 @@ int main()
     {
         typedef int& T;
         std::future<T> f0;
+        static_assert( noexcept(f0.share()), "");
         std::shared_future<T> f = std::move(f0.share());
         assert(!f0.valid());
         assert(!f.valid());
@@ -55,6 +59,7 @@ int main()
         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());
         assert(!f0.valid());
         assert(f.valid());
@@ -62,6 +67,7 @@ int main()
     {
         typedef void T;
         std::future<T> f0;
+        static_assert( noexcept(f0.share()), "");
         std::shared_future<T> f = std::move(f0.share());
         assert(!f0.valid());
         assert(!f.valid());

Modified: libcxx/trunk/www/cxx1z_status.html
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=292992&r1=292991&r2=292992&view=diff
==============================================================================
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Tue Jan 24 17:28:25 2017
@@ -356,7 +356,7 @@
 	<tr><td><a href="http://wg21.link/LWG2540">2540</a></td><td>unordered_multimap::insert hint iterator</td><td>Issaquah</td><td>Complete</td></tr>
 	<tr><td><a href="http://wg21.link/LWG2543">2543</a></td><td>LWG 2148 (hash support for enum types) seems under-specified</td><td>Issaquah</td><td>Complete</td></tr>
 	<tr><td><a href="http://wg21.link/LWG2544">2544</a></td><td>istreambuf_iterator(basic_streambuf<charT, traits>* s) effects unclear when s is 0</td><td>Issaquah</td><td>Complete</td></tr>
-	<tr><td><a href="http://wg21.link/LWG2556">2556</a></td><td>Wide contract for future::share()</td><td>Issaquah</td><td>Patch ready</td></tr>
+	<tr><td><a href="http://wg21.link/LWG2556">2556</a></td><td>Wide contract for future::share()</td><td>Issaquah</td><td>Complete</td></tr>
 	<tr><td><a href="http://wg21.link/LWG2562">2562</a></td><td>Consistent total ordering of pointers by comparison functors</td><td>Issaquah</td><td></td></tr>
 	<tr><td><a href="http://wg21.link/LWG2567">2567</a></td><td>Specification of logical operator traits uses BaseCharacteristic, which is defined only for UnaryTypeTraits and BinaryTypeTraits</td><td>Issaquah</td><td>Complete</td></tr>
 	<tr><td><a href="http://wg21.link/LWG2568">2568</a></td><td>[fund.ts.v2] Specification of logical operator traits uses BaseCharacteristic, which is defined only for UnaryTypeTraits and BinaryTypeTraits</td><td>Issaquah</td><td></td></tr>




More information about the cfe-commits mailing list