From 0b958696f5bd639ff64e6731a2f01f99b305519f Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 25 May 2017 18:52:34 +0000 Subject: [PATCH] Update coroutine_handle

::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. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303895 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/coroutine | 10 ++-------- .../coroutine.handle.prom/promise.sh.cpp | 6 +++--- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/include/experimental/coroutine b/include/experimental/coroutine index 208a4d217..f53aceaa3 100644 --- a/include/experimental/coroutine +++ b/include/experimental/coroutine @@ -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)); } diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp index 290aaa382..597ffd6d2 100644 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.sh.cpp @@ -39,12 +39,12 @@ void do_test(coro::coroutine_handle&& H) { // 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()); } }