From d30c842d85676d16b9c84edaf4268d507275fb3e Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Mon, 29 Jun 2026 14:12:22 +0200 Subject: [PATCH] :bug: only build module for GCC Signed-off-by: Niels Lohmann --- .github/workflows/ubuntu.yml | 5 ++++- tests/module_cpp20/main.cpp | 13 +++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 7eacb57cf..dc604bde8 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -247,7 +247,10 @@ jobs: ci_module_cpp20: strategy: matrix: - container: ['gcc:latest', 'silkeh/clang:latest'] + # Only Clang for now: GCC's C++20 modules support (as of GCC 16.1) cannot + # compile non-trivial use of the imported module (redefinition / missing + # include errors in libstdc++). + container: ['silkeh/clang:latest'] runs-on: ubuntu-latest container: ${{ matrix.container }} steps: diff --git a/tests/module_cpp20/main.cpp b/tests/module_cpp20/main.cpp index 5339dff82..56384b9af 100644 --- a/tests/module_cpp20/main.cpp +++ b/tests/module_cpp20/main.cpp @@ -13,10 +13,15 @@ import nlohmann.json; using namespace nlohmann::literals; -// Exercise each name exported by the nlohmann.json module so that a missing or -// broken export is caught at compile time. This target is only built (not run) -// by the ci_module_cpp20 CI job, so the checks are primarily compile-time; the -// return value additionally validates them if the binary is executed. +// This test exercises the surface exported by the nlohmann.json module so that +// a missing or broken export is caught at compile time. +// +// NOTE: It is only built with Clang. GCC's C++20 modules implementation (as of +// GCC 16.1) cannot compile non-trivial use of the imported module: any standard +// library facility reached through the module triggers redefinition or missing +// include errors in libstdc++ (and using `import` together with textual +// `#include`s of standard headers fails as well). The ci_module_cpp20 job is +// therefore restricted to Clang until GCC's modules support matures. int main() { // basic_json / json: parsing and value access