C++ find co_await awaitable result type

There is no way to do this generally because co_await's coroutine machinery is in part dependent on the promise type for the function that invokes co_await. When a co_await <expr> is invoked, it will have to transform <expr> into an awaitable type. Part of that process involves asking the promise type for the coroutine to weigh in on this conversion if it so chooses. Since the promise type is defined by the signature of the coroutine, the result type of any co_await <expr> is therefore dependent on the signature of the function invoking it.

This is why co_await cannot be used in an unevaluated context; it's behavior is context-dependent.

Now, if you know that your promise type does not have await_transform (which you probably do know, since it's your promise type), then the result type is possible to compute. The awaitable type for co_await <expr> will just be the type of <expr>. This is then converted into an awaiter object via invoking operator co_await on the expression. That's a bit difficult to compute, as it could be invoked via a member function or a non-member operator call, so it's a tricky bit of metaprogramming.

Once you have the awaiter object type, you can get the return type of its await_resume(); this is the type of the co_await <expr> expression.