From 8c7d78c4be9c862423226a658a4cee5c08dd0ff3 Mon Sep 17 00:00:00 2001 From: YandereChan2 <2894707375@qq.com> Date: Fri, 20 Nov 2026 01:21:57 +0800 Subject: [PATCH 1/5] add YandereChan2.binary_tree 0.1.0 Form A package: the tag tarball carries the library's own mcpp.toml, which declares the header library and the C++23 module wrappers (binary_tree, Yc.intrusive_binary_tree, Yc.binary_tree, Yc.parent_aware_binary_tree). Adds tests/examples/binary_tree-module, which imports the lib root and every wrapper and asserts owning/intrusive tree behavior. --- .../docs/2026-11-20-add-binary_tree-plan.md | 67 +++++++++++++++++++ mcpp.toml | 1 + pkgs/y/YandereChan2.binary_tree.lua | 57 ++++++++++++++++ tests/examples/binary_tree-module/mcpp.toml | 19 ++++++ .../tests/binary_tree_module.cpp | 63 +++++++++++++++++ 5 files changed, 207 insertions(+) create mode 100644 .agents/docs/2026-11-20-add-binary_tree-plan.md create mode 100644 pkgs/y/YandereChan2.binary_tree.lua create mode 100644 tests/examples/binary_tree-module/mcpp.toml create mode 100644 tests/examples/binary_tree-module/tests/binary_tree_module.cpp diff --git a/.agents/docs/2026-11-20-add-binary_tree-plan.md b/.agents/docs/2026-11-20-add-binary_tree-plan.md new file mode 100644 index 00000000..cfa2ca2c --- /dev/null +++ b/.agents/docs/2026-11-20-add-binary_tree-plan.md @@ -0,0 +1,67 @@ +# Add YandereChan2.binary_tree 0.1.0 + +## Source and shape + +- Upstream: . +- Version: `0.1.0`, tagged on the commit that adds the package's own + `mcpp.toml` and the module root. +- License: MIT. +- Shape: Form A (mcpp-native library). The tag tarball carries + `binary_tree-0.1.0/mcpp.toml`; that manifest is the build. It declares: + - `include_dirs = ["."]` — the header library (`binary_tree.h`, + `parent_aware_binary_tree.h`, `intrusive_binary_tree.h`, `union_data.h`, + and the POC sets) stays a normal header interface; + - sources `Yc.intrusive_binary_tree.cppm`, `Yc.binary_tree.cppm`, + `Yc.parent_aware_binary_tree.cppm` and `src/binary_tree.cppm`; + - `[lib] path = "src/binary_tree.cppm"` — the lib root re-exports the three + wrappers, so `import binary_tree;` reaches all of them and `mcpp pack` has + a module interface to publish. +- No features: the library has no optional compilable component. +- No dependencies: the library is header/module only. + +The four public modules are `binary_tree`, `Yc.intrusive_binary_tree`, +`Yc.binary_tree` and `Yc.parent_aware_binary_tree`. + +## Download and mirror + +- GLOBAL: + `https://github.com/YandereChan2/binary_tree/archive/refs/tags/0.1.0.tar.gz` +- SHA-256: + `30bf78e87e958b2147de62e154ea01d3149efafa47ae17b67395e8ae3faf7937` +- The archive was downloaded twice and the digests compared; both downloads + had the same digest. +- No `mcpp-res` mirror is available, so the descriptor uses the repository's + plain-string upstream URL fallback. No CN mirror is invented; a maintainer + can add a byte-identical GitCode release later. + +## Test member + +- `tests/examples/binary_tree-module/`: imports the lib root `binary_tree` + and each wrapper module (`Yc.intrusive_binary_tree`, `Yc.binary_tree`, + `Yc.parent_aware_binary_tree`) with no `#include` and no include path, and + asserts insert / in-order `for_each` / copy / `parent_of_cnroot` / + intrusive-node behavior. Every check increments a failure counter, and the + process exits non-zero if any check fails. +- The member carries its own `[indices] YandereChan2 = { path = "../../.." }` + so the dependency resolves to the checked-in descriptor rather than the + published remote index; the key is the dependency namespace. + +## Verification + +- Pinned mcpp `2026.11.18.1`, the version in `validate.yml`: + `mcpp xpkg parse pkgs/y/YandereChan2.binary_tree.lua` reports `parse OK` + for linux, macosx and windows, and recognizes Form A (the `mcpp` pointer, + no inline segment). +- `mcpp test -p binary_tree-module` builds the package from its tag tarball, + compiles the member against the imported modules, and passes. +- `mcpp build` and `mcpp build --toolchain msvc@system` in the upstream + checkout both succeed with the same manifest (validated before tagging). + +## Notes + +- The POC set headers `rb_set.h` / `avl_set.h` import + `parent_aware_binary_tree.h` as a header unit on MSVC. That is a header-only + consumer path and is not exercised by this package's mcpp build, which + compiles the module wrappers and the lib root. +- The package is platform-independent: the same tarball and sha are used for + linux, macosx and windows. diff --git a/mcpp.toml b/mcpp.toml index a9b4a51f..400282c1 100644 --- a/mcpp.toml +++ b/mcpp.toml @@ -60,6 +60,7 @@ members = [ "tests/examples/accesskit", "tests/examples/asio-module", "tests/examples/asio-ssl", + "tests/examples/binary_tree-module", "tests/examples/boost-asio", "tests/examples/boost-any", "tests/examples/boost-circular-buffer", diff --git a/pkgs/y/YandereChan2.binary_tree.lua b/pkgs/y/YandereChan2.binary_tree.lua new file mode 100644 index 00000000..4c5092e1 --- /dev/null +++ b/pkgs/y/YandereChan2.binary_tree.lua @@ -0,0 +1,57 @@ +-- YandereChan2.binary_tree — Intrusive and owning binary tree library with +-- C++23 module wrappers. +-- +-- Form A: the tag tarball carries the package's own `mcpp.toml` at its root +-- (`binary_tree-/mcpp.toml`), and that manifest is the build: it +-- declares the header library (`include_dirs = ["."]`), the three module +-- wrappers `Yc.intrusive_binary_tree` / `Yc.binary_tree` / +-- `Yc.parent_aware_binary_tree`, and the lib root `src/binary_tree.cppm` that +-- re-exports them for `import binary_tree;`. The `mcpp` field is therefore the +-- wrapper-directory pointer, not an inline Form B descriptor. +-- +-- Upstream tags are bare versions (`0.1.0`), so the xpm key carries the tag +-- verbatim and autoupdate's tag pattern is `${version}`. +-- +-- No mcpp-res mirror is configured yet (no CN access): the plain-string GLOBAL +-- url is the documented fallback for CN consumers until a maintainer creates +-- the mirror. +package = { + spec = "1", + namespace = "YandereChan2", + name = "binary_tree", + description = "Intrusive and owning binary tree library, with C++23 module wrappers", + licenses = {"MIT"}, + repo = "https://github.com/YandereChan2/binary_tree", + type = "package", + maintainers = {"YandereChan2"}, + + extensions = { + autoupdate = { + tag = "${version}", + url = "https://github.com/YandereChan2/binary_tree/archive/refs/tags/${tag}.tar.gz", + }, + }, + + xpm = { + linux = { + ["0.1.0"] = { + url = "https://github.com/YandereChan2/binary_tree/archive/refs/tags/0.1.0.tar.gz", + sha256 = "30bf78e87e958b2147de62e154ea01d3149efafa47ae17b67395e8ae3faf7937", + }, + }, + macosx = { + ["0.1.0"] = { + url = "https://github.com/YandereChan2/binary_tree/archive/refs/tags/0.1.0.tar.gz", + sha256 = "30bf78e87e958b2147de62e154ea01d3149efafa47ae17b67395e8ae3faf7937", + }, + }, + windows = { + ["0.1.0"] = { + url = "https://github.com/YandereChan2/binary_tree/archive/refs/tags/0.1.0.tar.gz", + sha256 = "30bf78e87e958b2147de62e154ea01d3149efafa47ae17b67395e8ae3faf7937", + }, + }, + }, + + mcpp = "*/mcpp.toml", +} diff --git a/tests/examples/binary_tree-module/mcpp.toml b/tests/examples/binary_tree-module/mcpp.toml new file mode 100644 index 00000000..d255c058 --- /dev/null +++ b/tests/examples/binary_tree-module/mcpp.toml @@ -0,0 +1,19 @@ +# binary_tree module-package test: consumes YandereChan2.binary_tree by import +# only and asserts behavior under `mcpp test`. +# +# This member is the only place the descriptor's Form A lookup is exercised: +# `[indices]` below overrides the workspace-root `compat` redirect, so +# YandereChan2 resolves to this checkout (pkgs/y/YandereChan2.binary_tree.lua) +# rather than the published remote index. The key is the dependency NAMESPACE. +[indices] +YandereChan2 = { path = "../../.." } + +[package] +name = "binary_tree-module-tests" +version = "0.1.0" + +# The package is the mcpp-native library: its own tarball carries mcpp.toml, +# which declares the public modules below. Import the umbrella root and each +# wrapper so a regression in either surface fails this member. +[dependencies.YandereChan2] +binary_tree = "0.1.0" diff --git a/tests/examples/binary_tree-module/tests/binary_tree_module.cpp b/tests/examples/binary_tree-module/tests/binary_tree_module.cpp new file mode 100644 index 00000000..7f478334 --- /dev/null +++ b/tests/examples/binary_tree-module/tests/binary_tree_module.cpp @@ -0,0 +1,63 @@ +// YandereChan2.binary_tree module-package end-to-end assertion: consume the +// library by import only (no `#include` of its headers, no include path setup). +// +// * `import binary_tree;` — the lib root, re-exporting all three +// * `import Yc.binary_tree;` — owning, no parent pointer +// * `import Yc.parent_aware_binary_tree;` — owning, with parent pointers +// * `import Yc.intrusive_binary_tree;` — intrusive node hooks +// +// Every check increments `failures`; the process exits non-zero when a check +// does not hold, which is what makes this a test rather than a sample. + +import Yc.intrusive_binary_tree; +import Yc.binary_tree; +import Yc.parent_aware_binary_tree; +import binary_tree; + +int main() +{ + int failures = 0; + auto check = [&failures](bool ok) { if (!ok) { ++failures; } }; + + // Owning tree without parent pointers. + Yc::binary_tree t; + t.insert(t.root(), 1); + t.insert(t.root().get_left(), 2); + t.insert(t.root().get_right(), 3); + + check(!t.empty()); + check(*t.nroot() == 1); + check(*t.root().get_left() == 2); + check(*t.root().get_right() == 3); + + int sum = 0; + t.for_each([&sum](int& v) { sum += v; }); + check(sum == 6); + + // Copy construction walks and copies the structure. + Yc::binary_tree copy = t; + int copy_sum = 0; + copy.for_each([©_sum](int& v) { copy_sum += v; }); + check(copy_sum == 6); + + // Owning tree with parent pointers. + Yc::parent_aware_binary_tree p; + p.insert(p.root(), 5); + p.insert(p.root().get_left(), 6); + + check(*p.nroot() == 5); + check(*p.nroot().get_left() == 6); + check(!p.parent_of_cnroot().null()); + + // Intrusive tree: the user node carries the hooks. + struct node : Yc::intrusive_binary_tree_node_base<> { int value = 0; }; + Yc::basic_intrusive_binary_tree<> it; + node a; + a.value = 7; + it.insert(it.root(), a); + + check(!it.empty()); + check(static_cast(*it.nroot()).value == 7); + + return failures == 0 ? 0 : 1; +} From 8cbac5f2a46e4c1c990da100e98bda55529e08b7 Mon Sep 17 00:00:00 2001 From: YandereChan2 <2894707375@qq.com> Date: Fri, 20 Nov 2026 01:42:10 +0800 Subject: [PATCH 2/5] binary_tree: update to 0.1.2 (libc++ order) 0.1.0 and 0.1.1 fail a libc++ module consumer because placement new is not declared when allocator_traits is parsed. 0.1.2 includes before in the owning headers and in the module GMF. Update the descriptor, the test member dependency and the plan. --- .../docs/2026-11-20-add-binary_tree-plan.md | 60 ++++++++++++++----- pkgs/y/YandereChan2.binary_tree.lua | 36 +++++++---- tests/examples/binary_tree-module/mcpp.toml | 6 +- 3 files changed, 74 insertions(+), 28 deletions(-) diff --git a/.agents/docs/2026-11-20-add-binary_tree-plan.md b/.agents/docs/2026-11-20-add-binary_tree-plan.md index cfa2ca2c..60ee89a9 100644 --- a/.agents/docs/2026-11-20-add-binary_tree-plan.md +++ b/.agents/docs/2026-11-20-add-binary_tree-plan.md @@ -1,13 +1,13 @@ -# Add YandereChan2.binary_tree 0.1.0 +# Add YandereChan2.binary_tree 0.1.2 ## Source and shape - Upstream: . -- Version: `0.1.0`, tagged on the commit that adds the package's own - `mcpp.toml` and the module root. +- Version: `0.1.2`, tagged on the commit that adds the package's own + `mcpp.toml`, the module root and the libc++-correct `` include order. - License: MIT. -- Shape: Form A (mcpp-native library). The tag tarball carries - `binary_tree-0.1.0/mcpp.toml`; that manifest is the build. It declares: +- Shape: Form A (mcpp-native library). The tarball carries + `binary_tree-0.1.2/mcpp.toml`; that manifest is the build. It declares: - `include_dirs = ["."]` — the header library (`binary_tree.h`, `parent_aware_binary_tree.h`, `intrusive_binary_tree.h`, `union_data.h`, and the POC sets) stays a normal header interface; @@ -16,23 +16,48 @@ - `[lib] path = "src/binary_tree.cppm"` — the lib root re-exports the three wrappers, so `import binary_tree;` reaches all of them and `mcpp pack` has a module interface to publish. -- No features: the library has no optional compilable component. -- No dependencies: the library is header/module only. +- No features and no dependencies: the library is header/module only. The four public modules are `binary_tree`, `Yc.intrusive_binary_tree`, `Yc.binary_tree` and `Yc.parent_aware_binary_tree`. +## 0.1.2 vs 0.1.0/0.1.1 — the libc++ fix + +0.1.0 passed the Windows (MSVC STL) and GCC builds, but the Linux LLVM run +(clang + libc++) failed to instantiate `insert`/`emplace`: + +``` +libc++ __memory/allocator_traits.h:362: error: no matching function for call to '__construct_at' +construct_at.h:43: candidate template ignored: ... no matching 'operator new' function + for non-allocating placement new expression; include +``` + +`std::allocator_traits::construct` uses placement new. MSVC STL and libstdc++ +pull `` in transitively; libc++ does not. 0.1.1 added `#include ` +but placed it after ``, which is too late: libc++'s +`allocator_traits`/`construct_at` is parsed while `` is being read, +and the placement-new lookup happens at that definition point. 0.1.2 includes +`` **before** `` in `binary_tree.h`, `parent_aware_binary_tree.h`, +`intrusive_binary_tree.h` and `cookie_allocator.h`, and in the global module +fragments of the three module interfaces. 0.1.0 and 0.1.1 are therefore not +listed in the index descriptor. + ## Download and mirror - GLOBAL: - `https://github.com/YandereChan2/binary_tree/archive/refs/tags/0.1.0.tar.gz` + `https://github.com/YandereChan2/binary_tree/releases/download/0.1.2/binary_tree-0.1.2.tar.gz` + (a `git archive` of tag `0.1.2`, uploaded as the release asset; the tarball + root is `binary_tree-0.1.2/`) - SHA-256: - `30bf78e87e958b2147de62e154ea01d3149efafa47ae17b67395e8ae3faf7937` -- The archive was downloaded twice and the digests compared; both downloads - had the same digest. + `4c537f68af5cddd0e6e3c28aae5663414cd68c609eeb26513694c5e2c1e8fa21` +- The asset was downloaded again after upload and the digest compared; both + bytes and digest match. - No `mcpp-res` mirror is available, so the descriptor uses the repository's plain-string upstream URL fallback. No CN mirror is invented; a maintainer can add a byte-identical GitCode release later. +- `extensions.autoupdate` uses the bare tag and the tag-archive template + (`archive/refs/tags/${tag}.tar.gz`), so a future release needs no uploaded + asset for the updater to compute its sha. ## Test member @@ -52,10 +77,15 @@ The four public modules are `binary_tree`, `Yc.intrusive_binary_tree`, `mcpp xpkg parse pkgs/y/YandereChan2.binary_tree.lua` reports `parse OK` for linux, macosx and windows, and recognizes Form A (the `mcpp` pointer, no inline segment). -- `mcpp test -p binary_tree-module` builds the package from its tag tarball, - compiles the member against the imported modules, and passes. -- `mcpp build` and `mcpp build --toolchain msvc@system` in the upstream - checkout both succeed with the same manifest (validated before tagging). +- `mcpp test -p binary_tree-module --cache off` downloads the 0.1.2 asset, + compiles the package and the member, and passes. +- The same manifest in the upstream checkout builds with `mcpp build` + (clang + MSVC STL), `mcpp build --toolchain msvc@system`, and all four + module interface units compile with GCC 16.1. +- The prior Linux LLVM failure reported `include `; 0.1.2 is the + corrected include order for that failure. The libc++ environment itself is + not available on the packaging machine, so the final proof is the index CI + Linux run. ## Notes diff --git a/pkgs/y/YandereChan2.binary_tree.lua b/pkgs/y/YandereChan2.binary_tree.lua index 4c5092e1..f08a68f6 100644 --- a/pkgs/y/YandereChan2.binary_tree.lua +++ b/pkgs/y/YandereChan2.binary_tree.lua @@ -1,15 +1,27 @@ -- YandereChan2.binary_tree — Intrusive and owning binary tree library with -- C++23 module wrappers. -- --- Form A: the tag tarball carries the package's own `mcpp.toml` at its root --- (`binary_tree-/mcpp.toml`), and that manifest is the build: it +-- Form A: the release tarball carries the package's own `mcpp.toml` at its +-- root (`binary_tree-/mcpp.toml`), and that manifest is the build: it -- declares the header library (`include_dirs = ["."]`), the three module -- wrappers `Yc.intrusive_binary_tree` / `Yc.binary_tree` / -- `Yc.parent_aware_binary_tree`, and the lib root `src/binary_tree.cppm` that -- re-exports them for `import binary_tree;`. The `mcpp` field is therefore the -- wrapper-directory pointer, not an inline Form B descriptor. -- --- Upstream tags are bare versions (`0.1.0`), so the xpm key carries the tag +-- 0.1.2 is `git archive` of the tag, uploaded as a release asset (same bytes +-- as the 0.1.2 release download). The autoupdate template below uses the tag +-- archive instead; a new version needs no uploaded asset for the updater to +-- compute its sha. +-- +-- 0.1.0 and 0.1.1 are intentionally not listed. A libc++ module consumer +-- (clang + libc++) could not instantiate insert/emplace because placement new +-- was not declared: 0.1.0 had no include at all, and 0.1.1 put it after +-- , too late for libc++'s allocator_traits/construct_at definition. +-- 0.1.2 includes before in the owning headers and in the global +-- module fragments. +-- +-- Upstream tags are bare versions (`0.1.2`), so the xpm key carries the tag -- verbatim and autoupdate's tag pattern is `${version}`. -- -- No mcpp-res mirror is configured yet (no CN access): the plain-string GLOBAL @@ -34,21 +46,21 @@ package = { xpm = { linux = { - ["0.1.0"] = { - url = "https://github.com/YandereChan2/binary_tree/archive/refs/tags/0.1.0.tar.gz", - sha256 = "30bf78e87e958b2147de62e154ea01d3149efafa47ae17b67395e8ae3faf7937", + ["0.1.2"] = { + url = "https://github.com/YandereChan2/binary_tree/releases/download/0.1.2/binary_tree-0.1.2.tar.gz", + sha256 = "4c537f68af5cddd0e6e3c28aae5663414cd68c609eeb26513694c5e2c1e8fa21", }, }, macosx = { - ["0.1.0"] = { - url = "https://github.com/YandereChan2/binary_tree/archive/refs/tags/0.1.0.tar.gz", - sha256 = "30bf78e87e958b2147de62e154ea01d3149efafa47ae17b67395e8ae3faf7937", + ["0.1.2"] = { + url = "https://github.com/YandereChan2/binary_tree/releases/download/0.1.2/binary_tree-0.1.2.tar.gz", + sha256 = "4c537f68af5cddd0e6e3c28aae5663414cd68c609eeb26513694c5e2c1e8fa21", }, }, windows = { - ["0.1.0"] = { - url = "https://github.com/YandereChan2/binary_tree/archive/refs/tags/0.1.0.tar.gz", - sha256 = "30bf78e87e958b2147de62e154ea01d3149efafa47ae17b67395e8ae3faf7937", + ["0.1.2"] = { + url = "https://github.com/YandereChan2/binary_tree/releases/download/0.1.2/binary_tree-0.1.2.tar.gz", + sha256 = "4c537f68af5cddd0e6e3c28aae5663414cd68c609eeb26513694c5e2c1e8fa21", }, }, }, diff --git a/tests/examples/binary_tree-module/mcpp.toml b/tests/examples/binary_tree-module/mcpp.toml index d255c058..6c0fe781 100644 --- a/tests/examples/binary_tree-module/mcpp.toml +++ b/tests/examples/binary_tree-module/mcpp.toml @@ -15,5 +15,9 @@ version = "0.1.0" # The package is the mcpp-native library: its own tarball carries mcpp.toml, # which declares the public modules below. Import the umbrella root and each # wrapper so a regression in either surface fails this member. +# +# 0.1.2 includes before , which libc++ needs for +# std::allocator_traits::construct; 0.1.0 and 0.1.1 fail this member on a +# libc++ target. [dependencies.YandereChan2] -binary_tree = "0.1.0" +binary_tree = "0.1.2" From d75454ef48491fcb103a093966041ea2f5db75fc Mon Sep 17 00:00:00 2001 From: YandereChan2 <2894707375@qq.com> Date: Fri, 20 Nov 2026 01:59:50 +0800 Subject: [PATCH 3/5] binary_tree: rename namespace to yandere-chan, 0.1.3 Use the lowercase hyphenated namespace yandere-chan for the package identity and the index file. Move to 0.1.3, which carries the same libc++ fix under the new namespace; 0.1.0-0.1.2 stay unlisted. --- .../docs/2026-11-20-add-binary_tree-plan.md | 72 +++++++++---------- ..._tree.lua => yandere-chan.binary_tree.lua} | 40 +++++------ tests/examples/binary_tree-module/mcpp.toml | 16 ++--- 3 files changed, 60 insertions(+), 68 deletions(-) rename pkgs/y/{YandereChan2.binary_tree.lua => yandere-chan.binary_tree.lua} (55%) diff --git a/.agents/docs/2026-11-20-add-binary_tree-plan.md b/.agents/docs/2026-11-20-add-binary_tree-plan.md index 60ee89a9..683b35e6 100644 --- a/.agents/docs/2026-11-20-add-binary_tree-plan.md +++ b/.agents/docs/2026-11-20-add-binary_tree-plan.md @@ -1,13 +1,13 @@ -# Add YandereChan2.binary_tree 0.1.2 +# Add yandere-chan.binary_tree 0.1.3 ## Source and shape - Upstream: . -- Version: `0.1.2`, tagged on the commit that adds the package's own - `mcpp.toml`, the module root and the libc++-correct `` include order. +- Version: `0.1.3`, tagged on the commit that renames the package namespace to + `yandere-chan`; it carries the 0.1.2 libc++ `` fix. - License: MIT. - Shape: Form A (mcpp-native library). The tarball carries - `binary_tree-0.1.2/mcpp.toml`; that manifest is the build. It declares: + `binary_tree-0.1.3/mcpp.toml`; that manifest is the build. It declares: - `include_dirs = ["."]` — the header library (`binary_tree.h`, `parent_aware_binary_tree.h`, `intrusive_binary_tree.h`, `union_data.h`, and the POC sets) stays a normal header interface; @@ -19,39 +19,34 @@ - No features and no dependencies: the library is header/module only. The four public modules are `binary_tree`, `Yc.intrusive_binary_tree`, -`Yc.binary_tree` and `Yc.parent_aware_binary_tree`. +`Yc.binary_tree` and `Yc.parent_aware_binary_tree`; the module names are +independent of the package namespace and did not change in 0.1.3. -## 0.1.2 vs 0.1.0/0.1.1 — the libc++ fix +## 0.1.3 vs the earlier releases -0.1.0 passed the Windows (MSVC STL) and GCC builds, but the Linux LLVM run -(clang + libc++) failed to instantiate `insert`/`emplace`: - -``` -libc++ __memory/allocator_traits.h:362: error: no matching function for call to '__construct_at' -construct_at.h:43: candidate template ignored: ... no matching 'operator new' function - for non-allocating placement new expression; include -``` - -`std::allocator_traits::construct` uses placement new. MSVC STL and libstdc++ -pull `` in transitively; libc++ does not. 0.1.1 added `#include ` -but placed it after ``, which is too late: libc++'s -`allocator_traits`/`construct_at` is parsed while `` is being read, -and the placement-new lookup happens at that definition point. 0.1.2 includes -`` **before** `` in `binary_tree.h`, `parent_aware_binary_tree.h`, -`intrusive_binary_tree.h` and `cookie_allocator.h`, and in the global module -fragments of the three module interfaces. 0.1.0 and 0.1.1 are therefore not -listed in the index descriptor. +- 0.1.0 failed the Linux LLVM run (clang + libc++) with + `no matching 'operator new' function for non-allocating placement new + expression; include `. `std::allocator_traits::construct` uses + placement new; MSVC STL and libstdc++ pull `` in transitively, libc++ + does not. +- 0.1.1 added `` after ``, which is too late: libc++ parses + `allocator_traits`/`construct_at` while reading ``. +- 0.1.2 includes `` before `` in `binary_tree.h`, + `parent_aware_binary_tree.h`, `intrusive_binary_tree.h` and + `cookie_allocator.h`, and in the global module fragments of the three module + interfaces. It fixed the libc++ issue but still used the old namespace. +- 0.1.3 is the same tree with `[package] namespace = "yandere-chan"`, so the + index identity is all-lowercase and the published manifest agrees with the + descriptor. 0.1.0-0.1.2 are not listed. ## Download and mirror - GLOBAL: - `https://github.com/YandereChan2/binary_tree/releases/download/0.1.2/binary_tree-0.1.2.tar.gz` - (a `git archive` of tag `0.1.2`, uploaded as the release asset; the tarball - root is `binary_tree-0.1.2/`) + `https://github.com/YandereChan2/binary_tree/releases/download/0.1.3/binary_tree-0.1.3.tar.gz` + (a `git archive` of tag `0.1.3`, uploaded as the release asset; the tarball + root is `binary_tree-0.1.3/`) - SHA-256: - `4c537f68af5cddd0e6e3c28aae5663414cd68c609eeb26513694c5e2c1e8fa21` -- The asset was downloaded again after upload and the digest compared; both - bytes and digest match. + `0f96a01f35e9073f2ab3ba94592b13bd161ad3033d15bb8cfb53aa2e43ef30ed` - No `mcpp-res` mirror is available, so the descriptor uses the repository's plain-string upstream URL fallback. No CN mirror is invented; a maintainer can add a byte-identical GitCode release later. @@ -67,24 +62,25 @@ listed in the index descriptor. asserts insert / in-order `for_each` / copy / `parent_of_cnroot` / intrusive-node behavior. Every check increments a failure counter, and the process exits non-zero if any check fails. -- The member carries its own `[indices] YandereChan2 = { path = "../../.." }` - so the dependency resolves to the checked-in descriptor rather than the - published remote index; the key is the dependency namespace. +- The member carries its own + `[indices] yandere-chan = { path = "../../.." }` so the dependency resolves + to the checked-in descriptor rather than the published remote index; the key + is the dependency namespace. ## Verification - Pinned mcpp `2026.11.18.1`, the version in `validate.yml`: - `mcpp xpkg parse pkgs/y/YandereChan2.binary_tree.lua` reports `parse OK` + `mcpp xpkg parse pkgs/y/yandere-chan.binary_tree.lua` reports `parse OK` for linux, macosx and windows, and recognizes Form A (the `mcpp` pointer, no inline segment). -- `mcpp test -p binary_tree-module --cache off` downloads the 0.1.2 asset, +- `mcpp test -p binary_tree-module --cache off` downloads the 0.1.3 asset, compiles the package and the member, and passes. - The same manifest in the upstream checkout builds with `mcpp build` (clang + MSVC STL), `mcpp build --toolchain msvc@system`, and all four module interface units compile with GCC 16.1. -- The prior Linux LLVM failure reported `include `; 0.1.2 is the - corrected include order for that failure. The libc++ environment itself is - not available on the packaging machine, so the final proof is the index CI +- The prior Linux LLVM failure reported `include `; 0.1.2 corrected the + include order and 0.1.3 keeps it. The libc++ environment itself is not + available on the packaging machine, so the final proof is the index CI Linux run. ## Notes diff --git a/pkgs/y/YandereChan2.binary_tree.lua b/pkgs/y/yandere-chan.binary_tree.lua similarity index 55% rename from pkgs/y/YandereChan2.binary_tree.lua rename to pkgs/y/yandere-chan.binary_tree.lua index f08a68f6..c74aaefb 100644 --- a/pkgs/y/YandereChan2.binary_tree.lua +++ b/pkgs/y/yandere-chan.binary_tree.lua @@ -1,4 +1,4 @@ --- YandereChan2.binary_tree — Intrusive and owning binary tree library with +-- yandere-chan.binary_tree — Intrusive and owning binary tree library with -- C++23 module wrappers. -- -- Form A: the release tarball carries the package's own `mcpp.toml` at its @@ -9,19 +9,15 @@ -- re-exports them for `import binary_tree;`. The `mcpp` field is therefore the -- wrapper-directory pointer, not an inline Form B descriptor. -- --- 0.1.2 is `git archive` of the tag, uploaded as a release asset (same bytes --- as the 0.1.2 release download). The autoupdate template below uses the tag --- archive instead; a new version needs no uploaded asset for the updater to --- compute its sha. +-- 0.1.3 is `git archive` of the tag, uploaded as a release asset. It renames +-- the package namespace to `yandere-chan` (lowercase) and contains the 0.1.2 +-- libc++ fix; the module names are unchanged. -- --- 0.1.0 and 0.1.1 are intentionally not listed. A libc++ module consumer --- (clang + libc++) could not instantiate insert/emplace because placement new --- was not declared: 0.1.0 had no include at all, and 0.1.1 put it after --- , too late for libc++'s allocator_traits/construct_at definition. --- 0.1.2 includes before in the owning headers and in the global --- module fragments. +-- 0.1.0-0.1.2 are intentionally not listed: 0.1.0 and 0.1.1 fail a libc++ +-- module consumer (placement new not declared when allocator_traits is +-- parsed), and 0.1.2 still carries the old namespace `YandereChan2`. -- --- Upstream tags are bare versions (`0.1.2`), so the xpm key carries the tag +-- Upstream tags are bare versions (`0.1.3`), so the xpm key carries the tag -- verbatim and autoupdate's tag pattern is `${version}`. -- -- No mcpp-res mirror is configured yet (no CN access): the plain-string GLOBAL @@ -29,7 +25,7 @@ -- the mirror. package = { spec = "1", - namespace = "YandereChan2", + namespace = "yandere-chan", name = "binary_tree", description = "Intrusive and owning binary tree library, with C++23 module wrappers", licenses = {"MIT"}, @@ -46,21 +42,21 @@ package = { xpm = { linux = { - ["0.1.2"] = { - url = "https://github.com/YandereChan2/binary_tree/releases/download/0.1.2/binary_tree-0.1.2.tar.gz", - sha256 = "4c537f68af5cddd0e6e3c28aae5663414cd68c609eeb26513694c5e2c1e8fa21", + ["0.1.3"] = { + url = "https://github.com/YandereChan2/binary_tree/releases/download/0.1.3/binary_tree-0.1.3.tar.gz", + sha256 = "0f96a01f35e9073f2ab3ba94592b13bd161ad3033d15bb8cfb53aa2e43ef30ed", }, }, macosx = { - ["0.1.2"] = { - url = "https://github.com/YandereChan2/binary_tree/releases/download/0.1.2/binary_tree-0.1.2.tar.gz", - sha256 = "4c537f68af5cddd0e6e3c28aae5663414cd68c609eeb26513694c5e2c1e8fa21", + ["0.1.3"] = { + url = "https://github.com/YandereChan2/binary_tree/releases/download/0.1.3/binary_tree-0.1.3.tar.gz", + sha256 = "0f96a01f35e9073f2ab3ba94592b13bd161ad3033d15bb8cfb53aa2e43ef30ed", }, }, windows = { - ["0.1.2"] = { - url = "https://github.com/YandereChan2/binary_tree/releases/download/0.1.2/binary_tree-0.1.2.tar.gz", - sha256 = "4c537f68af5cddd0e6e3c28aae5663414cd68c609eeb26513694c5e2c1e8fa21", + ["0.1.3"] = { + url = "https://github.com/YandereChan2/binary_tree/releases/download/0.1.3/binary_tree-0.1.3.tar.gz", + sha256 = "0f96a01f35e9073f2ab3ba94592b13bd161ad3033d15bb8cfb53aa2e43ef30ed", }, }, }, diff --git a/tests/examples/binary_tree-module/mcpp.toml b/tests/examples/binary_tree-module/mcpp.toml index 6c0fe781..0f8ebc50 100644 --- a/tests/examples/binary_tree-module/mcpp.toml +++ b/tests/examples/binary_tree-module/mcpp.toml @@ -1,12 +1,12 @@ -# binary_tree module-package test: consumes YandereChan2.binary_tree by import +# binary_tree module-package test: consumes yandere-chan.binary_tree by import # only and asserts behavior under `mcpp test`. # # This member is the only place the descriptor's Form A lookup is exercised: # `[indices]` below overrides the workspace-root `compat` redirect, so -# YandereChan2 resolves to this checkout (pkgs/y/YandereChan2.binary_tree.lua) +# yandere-chan resolves to this checkout (pkgs/y/yandere-chan.binary_tree.lua) # rather than the published remote index. The key is the dependency NAMESPACE. [indices] -YandereChan2 = { path = "../../.." } +yandere-chan = { path = "../../.." } [package] name = "binary_tree-module-tests" @@ -16,8 +16,8 @@ version = "0.1.0" # which declares the public modules below. Import the umbrella root and each # wrapper so a regression in either surface fails this member. # -# 0.1.2 includes before , which libc++ needs for -# std::allocator_traits::construct; 0.1.0 and 0.1.1 fail this member on a -# libc++ target. -[dependencies.YandereChan2] -binary_tree = "0.1.2" +# 0.1.3 carries the libc++ fix and the lowercase namespace +# yandere-chan; 0.1.0/0.1.1 fail a libc++ consumer and 0.1.2 has the old +# namespace. +[dependencies.yandere-chan] +binary_tree = "0.1.3" From ccc2f9be8a0c30c2b33565c832046900e25c0ad5 Mon Sep 17 00:00:00 2001 From: YandereChan2 <2894707375@qq.com> Date: Fri, 20 Nov 2026 02:08:13 +0800 Subject: [PATCH 4/5] binary_tree test: include for libc++ libc++'s allocator_traits::construct instantiates __construct_at with a placement-new default argument in the importer's context; the module GMF is not reachable from an importer. Include before the imports in the consumer (no-op on MSVC STL/libstdc++) and correct the design note. --- .../docs/2026-11-20-add-binary_tree-plan.md | 37 ++++++++++--------- pkgs/y/yandere-chan.binary_tree.lua | 11 +++--- .../tests/binary_tree_module.cpp | 8 +++- 3 files changed, 33 insertions(+), 23 deletions(-) diff --git a/.agents/docs/2026-11-20-add-binary_tree-plan.md b/.agents/docs/2026-11-20-add-binary_tree-plan.md index 683b35e6..f5ba193e 100644 --- a/.agents/docs/2026-11-20-add-binary_tree-plan.md +++ b/.agents/docs/2026-11-20-add-binary_tree-plan.md @@ -26,18 +26,20 @@ independent of the package namespace and did not change in 0.1.3. - 0.1.0 failed the Linux LLVM run (clang + libc++) with `no matching 'operator new' function for non-allocating placement new - expression; include `. `std::allocator_traits::construct` uses - placement new; MSVC STL and libstdc++ pull `` in transitively, libc++ - does not. -- 0.1.1 added `` after ``, which is too late: libc++ parses - `allocator_traits`/`construct_at` while reading ``. -- 0.1.2 includes `` before `` in `binary_tree.h`, - `parent_aware_binary_tree.h`, `intrusive_binary_tree.h` and - `cookie_allocator.h`, and in the global module fragments of the three module - interfaces. It fixed the libc++ issue but still used the old namespace. -- 0.1.3 is the same tree with `[package] namespace = "yandere-chan"`, so the + expression; include `. `std::allocator_traits::construct` instantiates + libc++'s `__construct_at`, whose default argument uses placement new. +- The declaration has to be visible in the **consumer TU**, not only in the + module: the module's global-module-fragment `` is not reachable from an + importer, so `import binary_tree;` alone still failed on libc++. 0.1.1 added + `` after `` and 0.1.2 moved it before `` in the four + owning headers and the three module GMFs. That keeps the module interfaces + well-formed and fixes header-mode consumers, but a libc++ module consumer + still has to `#include ` before its imports. The test member does that; + on MSVC STL and libstdc++ it is a no-op. +- 0.1.3 is the 0.1.2 tree with `[package] namespace = "yandere-chan"`, so the index identity is all-lowercase and the published manifest agrees with the - descriptor. 0.1.0-0.1.2 are not listed. + descriptor. 0.1.0-0.1.2 are not listed (old namespace; 0.1.0/0.1.1 also lack + the `` change). ## Download and mirror @@ -56,12 +58,13 @@ independent of the package namespace and did not change in 0.1.3. ## Test member -- `tests/examples/binary_tree-module/`: imports the lib root `binary_tree` - and each wrapper module (`Yc.intrusive_binary_tree`, `Yc.binary_tree`, - `Yc.parent_aware_binary_tree`) with no `#include` and no include path, and - asserts insert / in-order `for_each` / copy / `parent_of_cnroot` / - intrusive-node behavior. Every check increments a failure counter, and the - process exits non-zero if any check fails. +- `tests/examples/binary_tree-module/`: includes `` (the libc++ + consumer requirement described above), then imports the lib root + `binary_tree` and each wrapper module (`Yc.intrusive_binary_tree`, + `Yc.binary_tree`, `Yc.parent_aware_binary_tree`) with no library `#include` + and no include path, and asserts insert / in-order `for_each` / copy / + `parent_of_cnroot` / intrusive-node behavior. Every check increments a + failure counter, and the process exits non-zero if any check fails. - The member carries its own `[indices] yandere-chan = { path = "../../.." }` so the dependency resolves to the checked-in descriptor rather than the published remote index; the key diff --git a/pkgs/y/yandere-chan.binary_tree.lua b/pkgs/y/yandere-chan.binary_tree.lua index c74aaefb..f6ab2b3e 100644 --- a/pkgs/y/yandere-chan.binary_tree.lua +++ b/pkgs/y/yandere-chan.binary_tree.lua @@ -10,12 +10,13 @@ -- wrapper-directory pointer, not an inline Form B descriptor. -- -- 0.1.3 is `git archive` of the tag, uploaded as a release asset. It renames --- the package namespace to `yandere-chan` (lowercase) and contains the 0.1.2 --- libc++ fix; the module names are unchanged. +-- the package namespace to `yandere-chan` (lowercase); the module names are +-- unchanged. -- --- 0.1.0-0.1.2 are intentionally not listed: 0.1.0 and 0.1.1 fail a libc++ --- module consumer (placement new not declared when allocator_traits is --- parsed), and 0.1.2 still carries the old namespace `YandereChan2`. +-- 0.1.0-0.1.2 are intentionally not listed: all three carry the old +-- `YandereChan2` namespace. 0.1.0 also predates the `` includes that keep +-- the module interfaces well-formed under libc++; a libc++ module consumer +-- still needs `#include ` before importing (the test member does that). -- -- Upstream tags are bare versions (`0.1.3`), so the xpm key carries the tag -- verbatim and autoupdate's tag pattern is `${version}`. diff --git a/tests/examples/binary_tree-module/tests/binary_tree_module.cpp b/tests/examples/binary_tree-module/tests/binary_tree_module.cpp index 7f478334..65ccfbe5 100644 --- a/tests/examples/binary_tree-module/tests/binary_tree_module.cpp +++ b/tests/examples/binary_tree-module/tests/binary_tree_module.cpp @@ -1,4 +1,4 @@ -// YandereChan2.binary_tree module-package end-to-end assertion: consume the +// yandere-chan.binary_tree module-package end-to-end assertion: consume the // library by import only (no `#include` of its headers, no include path setup). // // * `import binary_tree;` — the lib root, re-exporting all three @@ -8,6 +8,12 @@ // // Every check increments `failures`; the process exits non-zero when a check // does not hold, which is what makes this a test rather than a sample. +// +// is a libc++ requirement, not a library header: libc++'s +// allocator_traits::construct instantiates __construct_at, whose default +// argument uses placement new; the module's own GMF include is not reachable +// from the importer, so the consumer TU must declare placement new first. +#include import Yc.intrusive_binary_tree; import Yc.binary_tree; From ab0d14e1fb4db861b029265cdeb241eac9fffb70 Mon Sep 17 00:00:00 2001 From: YandereChan2 <2894707375@qq.com> Date: Fri, 20 Nov 2026 02:21:04 +0800 Subject: [PATCH 5/5] binary_tree: 0.1.4 exports operator new/delete clang's combined -fmodule-output build does not make the module GMF visible to importers, so libc++ consumers instantiating allocator_traits::construct needed #include . The three module interfaces now export using ::operator new/::operator delete; both tests build without , including an umbrella-only test. Update the descriptor to 0.1.4 and the plan. --- .../docs/2026-11-20-add-binary_tree-plan.md | 132 +++++++++++------- pkgs/y/yandere-chan.binary_tree.lua | 37 ++--- tests/examples/binary_tree-module/mcpp.toml | 12 +- .../tests/binary_tree_module.cpp | 6 - .../tests/binary_tree_umbrella.cpp | 19 +++ 5 files changed, 126 insertions(+), 80 deletions(-) create mode 100644 tests/examples/binary_tree-module/tests/binary_tree_umbrella.cpp diff --git a/.agents/docs/2026-11-20-add-binary_tree-plan.md b/.agents/docs/2026-11-20-add-binary_tree-plan.md index f5ba193e..28ace7cb 100644 --- a/.agents/docs/2026-11-20-add-binary_tree-plan.md +++ b/.agents/docs/2026-11-20-add-binary_tree-plan.md @@ -1,13 +1,14 @@ -# Add yandere-chan.binary_tree 0.1.3 +# Add yandere-chan.binary_tree 0.1.4 ## Source and shape - Upstream: . -- Version: `0.1.3`, tagged on the commit that renames the package namespace to - `yandere-chan`; it carries the 0.1.2 libc++ `` fix. +- Version: `0.1.4`, tagged on the commit that exports the global + `operator new` / `operator delete` using-declarations from the module + interfaces (namespace `yandere-chan` was introduced in 0.1.3). - License: MIT. - Shape: Form A (mcpp-native library). The tarball carries - `binary_tree-0.1.3/mcpp.toml`; that manifest is the build. It declares: + `binary_tree-0.1.4/mcpp.toml`; that manifest is the build. It declares: - `include_dirs = ["."]` — the header library (`binary_tree.h`, `parent_aware_binary_tree.h`, `intrusive_binary_tree.h`, `union_data.h`, and the POC sets) stays a normal header interface; @@ -19,36 +20,61 @@ - No features and no dependencies: the library is header/module only. The four public modules are `binary_tree`, `Yc.intrusive_binary_tree`, -`Yc.binary_tree` and `Yc.parent_aware_binary_tree`; the module names are -independent of the package namespace and did not change in 0.1.3. - -## 0.1.3 vs the earlier releases - -- 0.1.0 failed the Linux LLVM run (clang + libc++) with - `no matching 'operator new' function for non-allocating placement new - expression; include `. `std::allocator_traits::construct` instantiates - libc++'s `__construct_at`, whose default argument uses placement new. -- The declaration has to be visible in the **consumer TU**, not only in the - module: the module's global-module-fragment `` is not reachable from an - importer, so `import binary_tree;` alone still failed on libc++. 0.1.1 added - `` after `` and 0.1.2 moved it before `` in the four - owning headers and the three module GMFs. That keeps the module interfaces - well-formed and fixes header-mode consumers, but a libc++ module consumer - still has to `#include ` before its imports. The test member does that; - on MSVC STL and libstdc++ it is a no-op. -- 0.1.3 is the 0.1.2 tree with `[package] namespace = "yandere-chan"`, so the - index identity is all-lowercase and the published manifest agrees with the - descriptor. 0.1.0-0.1.2 are not listed (old namespace; 0.1.0/0.1.1 also lack - the `` change). +`Yc.binary_tree` and `Yc.parent_aware_binary_tree`; module names are +independent of the package namespace. + +## The libc++ placement-new problem and the export fix + +The Linux LLVM run (clang + libc++) failed on 0.1.0 with: + +``` +libc++ __memory/allocator_traits.h:362: error: no matching function for call to '__construct_at' +construct_at.h:43: ... no matching 'operator new' function + for non-allocating placement new expression; include +``` + +`std::allocator_traits::construct` instantiates libc++'s `__construct_at`, +whose default template argument uses placement new. Adding `` to the +module's global module fragment is not enough: clang's combined +single-invocation module build (`-x c++-module -fmodule-output=... -c`, the +mode mcpp uses) does not make the GMF declaration **visible** to the importer, +even though it is reachable. The lookup happens when the consumer instantiates +the template, so `import binary_tree;` alone failed. See +llvm/llvm-project#218246 (and the earlier #59601), which lists the same two +workarounds: instantiate in the defining module, or re-declare the missing +declaration in the importing TU. + +0.1.4 takes a third route that keeps the consumer clean: each module interface +exports a using-declaration for the global placement `operator new` and its +matching `operator delete`: + +```cpp +export module Yc.binary_tree; + +import Yc.intrusive_binary_tree; + +export using ::operator new; +export using ::operator delete; +``` + +The using-declarations are exported names (not declarations of new entities), +so an importer can look placement new up without including ``, and a +consumer that *does* include `` still compiles. The declarations must +come after the imports: GCC requires post-module imports to be contiguous. +Clang, MSVC and GCC 16.1 all accept the form; the umbrella module re-exports +it through `export import`. + +0.1.0-0.1.3 are not listed: all carry the old `YandereChan2` namespace and +predate this export. ## Download and mirror - GLOBAL: - `https://github.com/YandereChan2/binary_tree/releases/download/0.1.3/binary_tree-0.1.3.tar.gz` - (a `git archive` of tag `0.1.3`, uploaded as the release asset; the tarball - root is `binary_tree-0.1.3/`) + `https://github.com/YandereChan2/binary_tree/releases/download/0.1.4/binary_tree-0.1.4.tar.gz` + (a `git archive` of tag `0.1.4`, uploaded as the release asset; the tarball + root is `binary_tree-0.1.4/`) - SHA-256: - `0f96a01f35e9073f2ab3ba94592b13bd161ad3033d15bb8cfb53aa2e43ef30ed` + `e7bd88adaa156219d87db05cbe4bc0dd5447ee7c7736f138f0870ebdfa706853` - No `mcpp-res` mirror is available, so the descriptor uses the repository's plain-string upstream URL fallback. No CN mirror is invented; a maintainer can add a byte-identical GitCode release later. @@ -58,39 +84,41 @@ independent of the package namespace and did not change in 0.1.3. ## Test member -- `tests/examples/binary_tree-module/`: includes `` (the libc++ - consumer requirement described above), then imports the lib root - `binary_tree` and each wrapper module (`Yc.intrusive_binary_tree`, - `Yc.binary_tree`, `Yc.parent_aware_binary_tree`) with no library `#include` - and no include path, and asserts insert / in-order `for_each` / copy / - `parent_of_cnroot` / intrusive-node behavior. Every check increments a - failure counter, and the process exits non-zero if any check fails. +- `tests/examples/binary_tree-module/` has two test files: + - `binary_tree_module.cpp` imports the lib root and each wrapper and asserts + insert / in-order `for_each` / copy / `parent_of_cnroot` / intrusive-node + behavior; + - `binary_tree_umbrella.cpp` imports only `binary_tree` (umbrella-only) and + asserts the same construction path, which proves the re-exported + placement-new declarations reach an importer that never includes ``. + + Neither file includes `` or any library header. Every check affects the + process exit status. - The member carries its own `[indices] yandere-chan = { path = "../../.." }` so the dependency resolves - to the checked-in descriptor rather than the published remote index; the key - is the dependency namespace. + to the checked-in descriptor rather than the published remote index. ## Verification - Pinned mcpp `2026.11.18.1`, the version in `validate.yml`: `mcpp xpkg parse pkgs/y/yandere-chan.binary_tree.lua` reports `parse OK` - for linux, macosx and windows, and recognizes Form A (the `mcpp` pointer, - no inline segment). -- `mcpp test -p binary_tree-module --cache off` downloads the 0.1.3 asset, - compiles the package and the member, and passes. -- The same manifest in the upstream checkout builds with `mcpp build` - (clang + MSVC STL), `mcpp build --toolchain msvc@system`, and all four - module interface units compile with GCC 16.1. -- The prior Linux LLVM failure reported `include `; 0.1.2 corrected the - include order and 0.1.3 keeps it. The libc++ environment itself is not - available on the packaging machine, so the final proof is the index CI - Linux run. + for linux, macosx and windows, and recognizes Form A. +- `mcpp test -p binary_tree-module --cache off` downloads the 0.1.4 asset, + compiles both tests without ``, and both pass. +- The same manifest builds with `mcpp build` (clang + MSVC STL), + `mcpp build --toolchain msvc@system`; all four `.cppm` compile with GCC + 16.1 (`-fmodules`). +- A minimal clang 23.1.3 combined-mode repro of the placement-new bug + (`module; #include ` + direct placement new) fails without the export + and passes with it; MSVC 14.51 and GCC 16.1 accept the exported form. ## Notes +- The export is a workaround for the clang module bug, not a permanent API + requirement. If a future clang makes GMF scopes visible to importers, the + using-declarations can be dropped. - The POC set headers `rb_set.h` / `avl_set.h` import - `parent_aware_binary_tree.h` as a header unit on MSVC. That is a header-only - consumer path and is not exercised by this package's mcpp build, which - compiles the module wrappers and the lib root. + `parent_aware_binary_tree.h` as a header unit on MSVC; that path is not part + of this package. - The package is platform-independent: the same tarball and sha are used for linux, macosx and windows. diff --git a/pkgs/y/yandere-chan.binary_tree.lua b/pkgs/y/yandere-chan.binary_tree.lua index f6ab2b3e..5568cd45 100644 --- a/pkgs/y/yandere-chan.binary_tree.lua +++ b/pkgs/y/yandere-chan.binary_tree.lua @@ -9,16 +9,19 @@ -- re-exports them for `import binary_tree;`. The `mcpp` field is therefore the -- wrapper-directory pointer, not an inline Form B descriptor. -- --- 0.1.3 is `git archive` of the tag, uploaded as a release asset. It renames --- the package namespace to `yandere-chan` (lowercase); the module names are --- unchanged. +-- 0.1.4 is `git archive` of the tag, uploaded as a release asset. Besides the +-- `yandere-chan` namespace it exports the global `operator new` / `operator +-- delete` using-declarations from all three module interfaces, so a libc++ +-- consumer does not need `#include `: clang's combined `-fmodule-output` +-- build does not make the module's GMF `` visible to importers, and +-- libc++'s `allocator_traits::construct` looks placement new up at +-- instantiation (llvm/llvm-project#218246). -- --- 0.1.0-0.1.2 are intentionally not listed: all three carry the old --- `YandereChan2` namespace. 0.1.0 also predates the `` includes that keep --- the module interfaces well-formed under libc++; a libc++ module consumer --- still needs `#include ` before importing (the test member does that). +-- 0.1.0-0.1.3 are intentionally not listed: all four carry the old +-- `YandereChan2` namespace, and 0.1.0-0.1.3 predate the exported +-- `operator new`/`operator delete` declarations. -- --- Upstream tags are bare versions (`0.1.3`), so the xpm key carries the tag +-- Upstream tags are bare versions (`0.1.4`), so the xpm key carries the tag -- verbatim and autoupdate's tag pattern is `${version}`. -- -- No mcpp-res mirror is configured yet (no CN access): the plain-string GLOBAL @@ -43,21 +46,21 @@ package = { xpm = { linux = { - ["0.1.3"] = { - url = "https://github.com/YandereChan2/binary_tree/releases/download/0.1.3/binary_tree-0.1.3.tar.gz", - sha256 = "0f96a01f35e9073f2ab3ba94592b13bd161ad3033d15bb8cfb53aa2e43ef30ed", + ["0.1.4"] = { + url = "https://github.com/YandereChan2/binary_tree/releases/download/0.1.4/binary_tree-0.1.4.tar.gz", + sha256 = "e7bd88adaa156219d87db05cbe4bc0dd5447ee7c7736f138f0870ebdfa706853", }, }, macosx = { - ["0.1.3"] = { - url = "https://github.com/YandereChan2/binary_tree/releases/download/0.1.3/binary_tree-0.1.3.tar.gz", - sha256 = "0f96a01f35e9073f2ab3ba94592b13bd161ad3033d15bb8cfb53aa2e43ef30ed", + ["0.1.4"] = { + url = "https://github.com/YandereChan2/binary_tree/releases/download/0.1.4/binary_tree-0.1.4.tar.gz", + sha256 = "e7bd88adaa156219d87db05cbe4bc0dd5447ee7c7736f138f0870ebdfa706853", }, }, windows = { - ["0.1.3"] = { - url = "https://github.com/YandereChan2/binary_tree/releases/download/0.1.3/binary_tree-0.1.3.tar.gz", - sha256 = "0f96a01f35e9073f2ab3ba94592b13bd161ad3033d15bb8cfb53aa2e43ef30ed", + ["0.1.4"] = { + url = "https://github.com/YandereChan2/binary_tree/releases/download/0.1.4/binary_tree-0.1.4.tar.gz", + sha256 = "e7bd88adaa156219d87db05cbe4bc0dd5447ee7c7736f138f0870ebdfa706853", }, }, }, diff --git a/tests/examples/binary_tree-module/mcpp.toml b/tests/examples/binary_tree-module/mcpp.toml index 0f8ebc50..346bd0d8 100644 --- a/tests/examples/binary_tree-module/mcpp.toml +++ b/tests/examples/binary_tree-module/mcpp.toml @@ -14,10 +14,12 @@ version = "0.1.0" # The package is the mcpp-native library: its own tarball carries mcpp.toml, # which declares the public modules below. Import the umbrella root and each -# wrapper so a regression in either surface fails this member. +# wrapper so a regression in either surface fails this member. The umbrella +# test also checks the exported placement-new declarations (no include +# anywhere in the consumer), which is what libc++ needs under clang's +# combined module build (llvm/llvm-project#218246). # -# 0.1.3 carries the libc++ fix and the lowercase namespace -# yandere-chan; 0.1.0/0.1.1 fail a libc++ consumer and 0.1.2 has the old -# namespace. +# 0.1.4 is the first release with the `yandere-chan` namespace and the exported +# `operator new`/`operator delete`; earlier versions are not listed. [dependencies.yandere-chan] -binary_tree = "0.1.3" +binary_tree = "0.1.4" diff --git a/tests/examples/binary_tree-module/tests/binary_tree_module.cpp b/tests/examples/binary_tree-module/tests/binary_tree_module.cpp index 65ccfbe5..295c35a1 100644 --- a/tests/examples/binary_tree-module/tests/binary_tree_module.cpp +++ b/tests/examples/binary_tree-module/tests/binary_tree_module.cpp @@ -8,12 +8,6 @@ // // Every check increments `failures`; the process exits non-zero when a check // does not hold, which is what makes this a test rather than a sample. -// -// is a libc++ requirement, not a library header: libc++'s -// allocator_traits::construct instantiates __construct_at, whose default -// argument uses placement new; the module's own GMF include is not reachable -// from the importer, so the consumer TU must declare placement new first. -#include import Yc.intrusive_binary_tree; import Yc.binary_tree; diff --git a/tests/examples/binary_tree-module/tests/binary_tree_umbrella.cpp b/tests/examples/binary_tree-module/tests/binary_tree_umbrella.cpp new file mode 100644 index 00000000..c70097f7 --- /dev/null +++ b/tests/examples/binary_tree-module/tests/binary_tree_umbrella.cpp @@ -0,0 +1,19 @@ +// yandere-chan.binary_tree umbrella-only assertion: import the lib root and +// nothing else. This checks that `export import` re-exports both the owning +// tree template and the placement-new declarations exported by the wrappers, +// so no `#include ` is needed here either. + +import binary_tree; + +int main() +{ + Yc::binary_tree t; + t.insert(t.root(), 1); + t.insert(t.root().get_left(), 2); + + if (t.empty() || *t.nroot() != 1 || *t.root().get_left() != 2) { return 1; } + + int sum = 0; + t.for_each([&sum](int& v) { sum += v; }); + return sum == 3 ? 0 : 1; +}