If the promise type has member await_transform, the object is transformed to get the awaitable, otherwise the object is the awaitable type.
If the awaitable type has member operator co_await() that returns an awaiter, it is call to get the awaiter.
If there is a global operator co_await() that matches this awaitable type and returns an awaiter, then it is call to get the awaiter.
Otherwise the awaitable object should be an awaiter.
co_await on the awaiter.
So the awaitable and awaitable_void concept in the include/coro/concepts/awaitable.hpp is wrong and cannot support all awaitable types. This pull request fixes this.
The sync_wait_task_promise_base is not used as a polymorphic base, so the virtual destructor is not needed. The pull request fixes this.
To support compilation using clang, the cmake files are changed. The fatal error when detecting clang compiler is canceled, and proper compile options are set.
To pass the tests, some tests themselves are changed for they used a temporary captured lambda object to create a coroutine. When the coroutine is resumed, the temporary lambda has already been destructed. So the captured value and references are move to the function parameter which will be saved on the coroutine frame.
The co_yield i++; in an example causes warning in clang, so it is changed into co_yield i; ++i;
to co_await some object:
So the
awaitable
andawaitable_void
concept in theinclude/coro/concepts/awaitable.hpp
is wrong and cannot support all awaitable types. This pull request fixes this.The
sync_wait_task_promise_base
is not used as a polymorphic base, so the virtual destructor is not needed. The pull request fixes this.To support compilation using clang, the cmake files are changed. The fatal error when detecting clang compiler is canceled, and proper compile options are set.
To pass the tests, some tests themselves are changed for they used a temporary captured lambda object to create a coroutine. When the coroutine is resumed, the temporary lambda has already been destructed. So the captured value and references are move to the function parameter which will be saved on the coroutine frame.
The
co_yield i++;
in an example causes warning in clang, so it is changed intoco_yield i; ++i;