From bae0a1d43c60c5cb69446fd98baa68ac501e396a Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Mon, 29 May 2017 06:42:01 +0000 Subject: Fix coroutine test failures caused by API misusages. More tests to come. I think that from_address overload should be deleted or ill-formed, except for the 'void*' one; The user cannot possibly have a typed pointer to the coroutine state. llvm-svn: 304131 --- libcxx/include/experimental/coroutine | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'libcxx/include/experimental/coroutine') diff --git a/libcxx/include/experimental/coroutine b/libcxx/include/experimental/coroutine index 42ee3ed2f97..d2a03ae8a8c 100644 --- a/libcxx/include/experimental/coroutine +++ b/libcxx/include/experimental/coroutine @@ -212,6 +212,15 @@ public: return __tmp; } + // NOTE: this overload isn't required by the standard but is needed so + // the deleted _Promise* overload doesn't make from_address(nullptr) + // ambiguous. + // FIXME: should from_address work with nullptr? + _LIBCPP_ALWAYS_INLINE + static coroutine_handle from_address(nullptr_t) _NOEXCEPT { + return {}; + } + // from_address cannot be used with the coroutines promise type. static coroutine_handle from_address(_Promise*) = delete; -- cgit v1.2.3