Skip to content

Commit e133896

Browse files
committed
Don't set ELIDEABLE_AFTER_AWAIT in modules for clang21
Due to a bug in clang, we can't use [[clang::coro_await_elidable]] with modules. This is fixed in clang22.
1 parent 94341ae commit e133896

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

async_simple/CommonMacros.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@
5454
#endif
5555
#endif
5656

57+
#if defined(ASYNC_SIMPLE_USE_MODULES) && defined(__clang__) && \
58+
(__clang_major__ >= 20 && __clang_major__ < 22)
59+
// When ASYNC_SIMPLE_USE_MODULES is defined and clang version is between 20 and 22,
60+
// do not define ELIDEABLE_AFTER_AWAIT due to a bug in clang.
61+
#define ELIDEABLE_AFTER_AWAIT
62+
#else
5763
#if __has_cpp_attribute(clang::coro_await_elidable)
5864
#define ELIDEABLE_AFTER_AWAIT [[clang::coro_await_elidable]]
5965
#else
@@ -64,5 +70,6 @@
6470
#define ELIDEABLE_AFTER_AWAIT
6571
#endif
6672
#endif
73+
#endif
6774

6875
#endif

0 commit comments

Comments
 (0)