diff options
| author | Eric Fiselier <eric@efcs.ca> | 2017-05-29 05:00:24 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2017-05-29 05:00:24 +0000 |
| commit | 207d13cf84fef9b11c6a7906e4cdb6eb7d204327 (patch) | |
| tree | 22c2debf5a01ef6842367127967067ba272c6966 /libcxx | |
| parent | eaacd070796eb4a96f3220490604081649846811 (diff) | |
| download | bcm5719-llvm-207d13cf84fef9b11c6a7906e4cdb6eb7d204327.tar.gz bcm5719-llvm-207d13cf84fef9b11c6a7906e4cdb6eb7d204327.zip | |
Fix multiple bugs in coroutine tests.
llvm-svn: 304124
Diffstat (limited to 'libcxx')
| -rw-r--r-- | libcxx/include/experimental/coroutine | 3 | ||||
| -rw-r--r-- | libcxx/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp | 10 |
2 files changed, 9 insertions, 4 deletions
diff --git a/libcxx/include/experimental/coroutine b/libcxx/include/experimental/coroutine index 206fde22a23..42ee3ed2f97 100644 --- a/libcxx/include/experimental/coroutine +++ b/libcxx/include/experimental/coroutine @@ -212,6 +212,9 @@ public: return __tmp; } + // from_address cannot be used with the coroutines promise type. + static coroutine_handle from_address(_Promise*) = delete; + _LIBCPP_ALWAYS_INLINE static coroutine_handle from_promise(_Promise& __promise) _NOEXCEPT { coroutine_handle __tmp; diff --git a/libcxx/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp b/libcxx/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp index ebe447c6cbf..56f47c8faf4 100644 --- a/libcxx/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp +++ b/libcxx/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp @@ -27,11 +27,11 @@ coro::suspend_never sn; struct MyFuture { struct promise_type { typedef coro::coroutine_handle<promise_type> HandleT; - coro::suspend_always initial_suspend() { return sa; } - coro::suspend_never final_suspend() { return sn; } + coro::suspend_never initial_suspend() { return sn; } + coro::suspend_always final_suspend() { return sa; } coro::suspend_never yield_value(int) { return sn; } MyFuture get_return_object() { - MyFuture f(HandleT::from_address(this)); + MyFuture f(HandleT::from_promise(*this)); return f; } void return_void() {} @@ -41,7 +41,6 @@ struct MyFuture { MyFuture() : p() {} MyFuture(HandleT h) : p(h) {} -private: coro::coroutine_handle<promise_type> p; }; @@ -54,4 +53,7 @@ MyFuture test_coro() { int main() { MyFuture f = test_coro(); + while (!f.p.done()) + f.p.resume(); + f.p.destroy(); } |

