Skip to content

0.19.1: json::value compiles under clang with libstdc++, and CI reads every build program as an editor does - #47

Merged
speak-agent merged 2 commits into
mainfrom
fix/json-value-and-toolchain-lanes
Oct 13, 2026
Merged

speak-agent merged 2 commits into
mainfrom
fix/json-value-and-toolchain-lanes

Conversation

@speak-agent

Copy link
Copy Markdown
Member

Closes #46.

The defect

mcpp::plugins::json::value held std::vector<std::pair<std::string, value>> members. Under clang with libstdc++'s std module the pair is instantiated while value is incomplete (incomplete type 'std::pair<…, value>' used in type trait expression), so mcpp.plugins does not compile. That is the combination an editor's clangd uses to read a project built with GCC, so every import mcpp.…; in such a project's build.mcpp showed Module file '…/mcpp.rules.qt.pcm' not found. GCC and clang with libc++ accept the code; no build failed.

The fix

struct member { std::string first; value second; }, with get() defined after both types are complete. members is used only in src/plugins.cppm, and emplace_back(key, v) builds the aggregate through C++20's parenthesized aggregate initialisation, so nothing else changes.

CI: the two combinations nothing compiled

job compiler + library what it runs
consumers (unchanged) GCC 16 + libstdc++ every fixture
toolchain-llvm (new) llvm@22.1.8 + libc++ builds and runs all-rules-compile (every member, called), plugin-logic (29 cases), embed ×3, island-interface, archive-consumer, spirv-module-consumer; --configure-only for the four Qt fixtures, whose Qt binaries are libstdc++ — the build program and library still compile and run
toolchain-editor (new) mcppls 0.0.15's clangd + libstdc++ mcppls diagnostics build.mcpp on all 37 fixtures with a build program; fails on an error, on a file it did not read, or on a run with no report; every diagnostic goes to the job summary

The device-toolchain fixtures (cuda, hip, sycl, multi-rule) already build with llvm@22.1.8 in consumers, and the deps members' libc++ rows are vcpkg-libcxx and cmake-cache there, so the llvm lane does not repeat them.

Measured locally before pushing:

  • the editor lane on the previous src/plugins.cppm: 34 of 37 fixtures fail with the error above; with this change, 0 errors in all 37;
  • the llvm lane: every step passes; the lane also asserts the build was linked with -stdlib=libc++.

The rule

docs/plugin-development.md §4: a plugin is the C++23 that all three accept (MSVC as well for the members that claim Windows), with the differences met so far — no std::pair/std::tuple element for a type holding a container of itself, no compiler's leniency, no std::println in a build program (macOS 14), no std::filesystem::path iterator in a module (MSVC 14.52).

Version 0.19.1: source-compatible, package floor unchanged (mcpp 2026.10.1.3).

… every build program as an editor does

`mcpp::plugins::json::value` held `std::vector<std::pair<std::string, value>>`.
Under clang with libstdc++'s `std` module the pair is instantiated while `value`
is incomplete, so `mcpp.plugins` failed to compile and an editor's clangd --
which reads a GCC project with exactly that combination -- showed every
`import mcpp.…;` of a build program as a missing module. GCC and clang with
libc++ accept the code, so no build ever failed.

A member is now a plain struct `member { first; second; }` and `get()` is
defined once both types are complete. `members` is used only inside the lib
root and the fields keep their names, so the change is source-compatible.

CI gains the two combinations it did not compile: `toolchain-llvm` builds and
runs the toolchain-neutral fixtures under llvm@22.1.8 with libc++ (the Qt
fixtures configure only, since Qt's Linux binaries are built against
libstdc++), and `toolchain-editor` reads every fixture's `build.mcpp` with
mcppls 0.0.15 over the GCC toolchain and fails on any error or on a file it did
not read. On the previous code 34 of 37 fixtures fail there.

docs/plugin-development.md §4 states the rule: a plugin is the C++23 that all
three accept, with the differences met so far.

Closes #46
@speak-agent
speak-agent merged commit d546ccd into main Oct 13, 2026
6 checks passed
@speak-agent
speak-agent deleted the fix/json-value-and-toolchain-lanes branch October 13, 2026 20:58
Sunrisepeak added a commit to Sunrisepeak/mcpp-language-server that referenced this pull request Oct 13, 2026
…nput is no change, a module that failed in an import is named, build.mcpp beside the mcpp extension (#58)

Typing (A4), idle (A1, A2), failed modules (A3) and build.mcpp beside mcpp-vscode (A6); plan .agents/docs/2026-10-14-cross-repo-build-mcpp-and-typing-cpu-plan.md. With mcpp-community/mcpp-vscode#18 and mcpp-community/mcpp-plugins#47.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

json::value does not compile under clang with libstdc++, so an editor shows every build program's imports as missing

2 participants