[libcxx] r303895 - Update coroutine_handle<P>::promise to reflect N4663.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Thu May 25 11:52:34 PDT 2017


Author: ericwf
Date: Thu May 25 13:52:34 2017
New Revision: 303895

URL: http://llvm.org/viewvc/llvm-project?rev=303895&view=rev
Log:
Update coroutine_handle<P>::promise to reflect N4663.

This patch updates the promise() member to match the current spec.
Specifically it removes the non-const overload and make the return
type of the const overload non-const.

This patch also makes the ASSERT_NOT_NOEXCEPT tests libc++ specific,
since other implementations may be free to strengthen the specification.

Modified:
    libcxx/trunk/include/experimental/coroutine
    libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp

Modified: libcxx/trunk/include/experimental/coroutine
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/coroutine?rev=303895&r1=303894&r2=303895&view=diff
==============================================================================
--- libcxx/trunk/include/experimental/coroutine (original)
+++ libcxx/trunk/include/experimental/coroutine Thu May 25 13:52:34 2017
@@ -194,15 +194,9 @@ public:
         return *this;
     }
 
-  _LIBCPP_INLINE_VISIBILITY
-    _Promise& promise() {
-        return *reinterpret_cast<_Promise*>(
-            __builtin_coro_promise(this->__handle_, alignof(_Promise), false));
-    }
-
     _LIBCPP_INLINE_VISIBILITY
-    _Promise const& promise() const {
-        return *reinterpret_cast<_Promise const*>(
+    _Promise& promise() const {
+        return *reinterpret_cast<_Promise*>(
             __builtin_coro_promise(this->__handle_, alignof(_Promise), false));
     }
 

Modified: libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp?rev=303895&r1=303894&r2=303895&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp (original)
+++ libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp Thu May 25 13:52:34 2017
@@ -39,12 +39,12 @@ void do_test(coro::coroutine_handle<Prom
   // FIXME Add a runtime test
   {
     ASSERT_SAME_TYPE(decltype(H.promise()), Promise&);
-    ASSERT_NOT_NOEXCEPT(H.promise());
+    LIBCPP_ASSERT_NOT_NOEXCEPT(H.promise());
   }
   {
     auto const& CH = H;
-    ASSERT_SAME_TYPE(decltype(CH.promise()), Promise const&);
-    ASSERT_NOT_NOEXCEPT(CH.promise());
+    ASSERT_SAME_TYPE(decltype(CH.promise()), Promise&);
+    LIBCPP_ASSERT_NOT_NOEXCEPT(CH.promise());
   }
 }
 




More information about the cfe-commits mailing list