chriskohlhoff / asio

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

llvm17(clang-cl) with awaitable build error #1468

Closed kahotv closed 2 months ago

kahotv commented 2 months ago

image

vs2022+llvm17 windows

#include <asio.hpp>
#include <asio/awaitable.hpp>
#pragma comment(lib,"ws2_32.lib")
asio::awaitable<void> test()
{
    printf("hello\n");
    co_return;
}
int main()
{
    asio::io_context io;
    asio::co_spawn(io, test(), asio::detached);
    io.run();
    printf("end\n");
}

build error:

1>TestNet.cpp(4,7): error : no template named 'awaitable' in namespace 'asio'
1>TestNet.cpp(7,2): error : std::coroutine_traits type was not found; include <coroutine> before defining a coroutine
1>TestNet.cpp(12,8): error : no member named 'co_spawn' in namespace 'asio'
Ramirisu commented 2 months ago

clang-cl support was disabled by 08d29812ada63ee1c003b321075817673139659c, but not sure why it got disabled. See also #1138

klemens-morgenstern commented 2 months ago

I am starting to understand why Chris just ignores issues.