According to cppreference.com ( https://en.cppreference.com/w/cpp/compiler_support#C.2B.2B20_features ) Clang has partial support of C++20 coroutines since version 8:
But if in Clang trunk (which is upcoming version 13) I write
#include <coroutine>
it results in the error( https://gcc.godbolt.org/z/rTfjbarKz ):
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/coroutine:334:2: error: "the coroutine header requires -fcoroutines"
#error "the coroutine header requires -fcoroutines"
And if I add -fcoroutines
flag in the command line, then Clang complains( https://gcc.godbolt.org/z/qMrv6nMzE ):
clang-13: error: unknown argument: '-fcoroutines'
Is there any way to start using C++20 coroutines in Clang?
#include <experimental/coroutine>
(without 's' at the end) – Nolan