[cfe-dev] Clang-Cl and Coroutines

Gaier, Bjoern via cfe-dev cfe-dev at lists.llvm.org
Wed Jan 2 04:38:25 PST 2019

Hey Clang-Team,

I'm a big fan of the Clang-cl compiler and its integration into VisualStudio2017 - I use it for private projects and even try to establish the compiler in my company.

Today I tried diving into Coroutines - a C++20 feature if I'm not mistaken. I followed a simple tutorial and created a source file, which I will attach to this mail.
Compiling this file with Clang-cl leads to a linker error: "unresolved external symbol _coro_destroy"

For me _coro_destoy seems to be the intrinsic for "__builtin_coro_destory" so I made a define statement to replace _coro_destory with the builtin function from Clang. That compiles! But calling the function will lead to a crash...

So I decided to go another way, I used the define statement to replace _coro_destory with an external function "_coro_destory2" - I generated an object file with that function, simply calling the _coro_destory intrinsic inside - compiled with MSVC2017. Sadly... this crashes as well...

When I compile the code with the VisualStudio compiler, then it works.

Long story short: can't I use Coroutines in Clang-cl? Or in a Visual Studio project with Clan-cl?

Kind greetings
Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. Junichi Tajika
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190102/a5b5eb8b/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CoRoutine.cpp
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190102/a5b5eb8b/attachment.ksh>

More information about the cfe-dev mailing list