diff options
| author | Eric Fiselier <eric@efcs.ca> | 2017-05-29 06:42:01 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2017-05-29 06:42:01 +0000 |
| commit | bae0a1d43c60c5cb69446fd98baa68ac501e396a (patch) | |
| tree | e84770bb092c72d16ead194c12449f1c9a3f3b11 /libcxx | |
| parent | 96ab48f9dac815219ed7f9a62283ce29e96429bd (diff) | |
| download | bcm5719-llvm-bae0a1d43c60c5cb69446fd98baa68ac501e396a.tar.gz bcm5719-llvm-bae0a1d43c60c5cb69446fd98baa68ac501e396a.zip | |
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
Diffstat (limited to 'libcxx')
4 files changed, 15 insertions, 6 deletions
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; diff --git a/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.sh.cpp b/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.sh.cpp index 7eae2d0e999..a744f56eb81 100644 --- a/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.sh.cpp +++ b/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.sh.cpp @@ -48,8 +48,8 @@ void do_test() { assert(bool(c) == false); } { // non-null case - int dummy = 42; - C c = C::from_address(&dummy); + char dummy = 42; + C c = C::from_address((void*)&dummy); assert(c.address() == &dummy); assert(bool(c) == true); } diff --git a/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/address.sh.cpp b/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/address.sh.cpp index b5b8c100295..7258f93905f 100644 --- a/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/address.sh.cpp +++ b/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/address.sh.cpp @@ -42,8 +42,8 @@ void do_test() { assert(c.address() == nullptr); } { - int dummy = 42; - C c = C::from_address(&dummy); + char dummy = 42; + C c = C::from_address((void*)&dummy); assert(c.address() == &dummy); } } diff --git a/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.sh.cpp b/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.sh.cpp index 356e1704f35..26a45b033ff 100644 --- a/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.sh.cpp +++ b/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.sh.cpp @@ -37,8 +37,8 @@ void do_test() { assert(c.address() == nullptr); } { - int dummy = 42; - C c = C::from_address(&dummy); + char dummy = 42; + C c = C::from_address((void*)&dummy); assert(c.address() == &dummy); } } |

