chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.85k stars 1.2k forks source link

asio config does not detect coroutine support with clang-cl as compiler #1138

Open Febbe opened 1 year ago

Febbe commented 1 year ago

When compiling ASIO via clang-cl version 15.0 on Windows, the ASIO config sets ASIO_HAS_CO_AWAIT to zero, even if clang actually has it.

The reason is in line 2024: if (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705) && !defined(__clang__)

My proposed solution is to use the <version> header. And check for #if defined(__cpp_lib_coroutine) && __cpp_lib_coroutine == 201902L

klemens-morgenstern commented 1 year ago

It works if you use libc++ by setting -stdlib=libc++.

Febbe commented 1 year ago

It works if you use libc++ by setting -stdlib=libc++.

Thank you, but not every one can change the STL :/. This might work in some cases for clangd users. But not for the hole project itself, for example.