Skip to content

Clang/GCC: Issue with operator co_await and winrt::impl::awaiter_finder #1219

@alvinhochun

Description

@alvinhochun

The promises winrt::fire_and_forget and winrt::impl::promise_base have the member function await_transform which uses winrt::impl::notify_awaiter, which uses winrt::impl::get_awaiter, which in turn uses winrt::impl::awaiter_finder.

When you do things like co_await 10ms in a coroutine with one of these promise types, the await_transform member function is called, and the operator co_await for std::chrono::duration is resolved by winrt::impl::get_awaiter using winrt::impl::awaiter_finder.

This works in MSVC, however Clang and GCC don't like it when the operator co_await is not declared before the definition of the awaiter_finder template class: https://godbolt.org/z/hbhhMdj3d

I believe this is the reason why some of the tests using co_await does not work on Clang without these workarounds in #1203.

Any ideas? I cannot tell which compilers are doing it wrong.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions