-
Notifications
You must be signed in to change notification settings - Fork 232
Description
When using stdexec as a header-only library in a C++20 modules project, CMake's module dependency scanner fails with a
preprocessor error:
Error while scanning dependencies for /path/to/scheduler.cppm:
In file included from 3rdparty/stdexec/include/stdexec/__detail/__concepts.hpp:18:
error: token is not a valid binary operator in a preprocessor subexpression
#if __cpp_concepts < 2019'07L
Environment:
- Compiler: Clang 21 / GCC 14
- CMake: 4.1
- Platform: WSL2 / Linux
- C++ Standard: C++23
- CMake setting: CMAKE_CXX_SCAN_FOR_MODULES ON
Root Cause:
The issue occurs during CMake's C++20 module dependency scanning phase. While modern compilers (Clang 21, GCC 14)
fully support digit separators (') in preprocessor expressions during normal compilation, the module dependency
scanner appears to use a different preprocessor mode that rejects digit separators in #if directives.
Affected Files:
- include/stdexec/__detail/__concepts.hpp:18: #if __cpp_concepts < 2019'07L
- include/stdexec/__detail/__config.hpp:20: #if __cplusplus < 2020'02L
- include/stdexec/__detail/__config.hpp:619: #if __has_include() && __cpp_lib_concepts >= 2020'02L
- include/exec/detail/intrusive_heap.hpp:31: #if defined(__cpp_lib_int_pow2) && __cpp_lib_int_pow2 >= 2020'02L
may be many more ......
Workaround:
Replace digit separators with plain numeric literals:
- 2019'07L → 201907L
- 2020'02L → 202002L