[cfe-dev] coroutine support in clang

Andrews, Elizabeth via cfe-dev cfe-dev at lists.llvm.org
Wed Jan 20 12:02:17 PST 2021


Hello,

Clang throws an error on Windows when I try to compile the following test.

ksh-3.2$ cat test.cpp
#include <coroutine>
#include <iostream>
using namespace std;
using std::coroutine_handle;
using std::suspend_always;

ksh-3.2$ clang-cl -c /std:c++latest test.cpp
test2.cpp(4,12): error: no member named 'coroutine_handle' in namespace 'std'
using std::coroutine_handle;
      ~~~~~^
test2.cpp(5,12): error: no member named 'suspend_always' in namespace 'std'
using std::suspend_always;
      ~~~~~^
2 errors generated.

I noticed the STL implementation (https://github.com/microsoft/STL/blob/master/stl/inc/coroutine#L16) was guarded with __cpp_lib_coroutine.  So I tried clang-cl -c /std:c++latest -D__cpp_lib_coroutine test.cpp and the header successfully compiled.

>From https://github.com/microsoft/STL/issues/1223, it looks like the errors are a known issue. __cpp_lib_coroutine will be defined by library only if compiler defines __cpp_impl_coroutine. I assume clang doesn't define the feature test macro because we lack sufficient coroutine support. Would someone here be able to confirm?

Also, if anyone has information about current status of coroutine support/what is missing, any help is greatly appreciated.

Thank you,
Elizabeth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20210120/3727e8c9/attachment.html>


More information about the cfe-dev mailing list