Open RedBeard0531 opened 1 year ago
FYI, I ran into this while comparing codegen between gcc and clang on godbolt, where cppcoro is an easy way to quickly play with coroutines. When doing this I couldn't make sense of the gcc codegen until I realized that it was actually being fed different code than clang. When I added -DCPPCORO_COMPILER_SUPPORTS_SYMMETRIC_TRANSFER
to the command line, everything made sense again. Hopefully nobody else has to go through this fun discovery process.
MSVC now supports symmetric transfer, and I think gcc has since it introduced coroutines support. However, cppcoro currently only uses symmetric transfer for clang >= 7.
https://github.com/lewissbaker/cppcoro/blob/391215262bd40d68ac6534810164131f5f9eb148/include/cppcoro/config.hpp#L33-L44
Rather than hard-coding a bunch more compiler versions, it may make more sense to check for
__cpp_impl_coroutine >= 201902
to automatically use symmetric transfer for any compiler that claims compliant support of the final coroutine spec (probably with|| __clang_minor__ >= 7
to keep working with old clang).