【发布时间】:2021-10-03 00:56:09
【问题描述】:
根据 cppreference.com (https://en.cppreference.com/w/cpp/compiler_support#C.2B.2B20_features) Clang 从版本 8 开始部分支持 C++20 协程:
但如果在 Clang 主干(即将发布的第 13 版)中,我会写
#include <coroutine>
导致错误(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"
如果我在命令行中添加 -fcoroutines 标志,那么 Clang 会抱怨(https://gcc.godbolt.org/z/qMrv6nMzE):
clang-13: error: unknown argument: '-fcoroutines'
有什么方法可以在 Clang 中开始使用 C++20 协程?
【问题讨论】:
标签: c++ c++20 clang++ c++-coroutine