You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: C++26 contracts support added
Adds a native C++26 contracts backend (P2900) to the contract-checking
machinery, next to the existing gsl-lite/ms-gsl ones:
- `MP_UNITS_API_CONTRACTS=STD` CMake option / `contracts=std` Conan option
(auto-detected via `__cpp_contracts >= 202502L`); experimental, requires
GCC 16 with `-fcontracts`
- each macro belongs to exactly one vocabulary now:
- `MP_UNITS_EXPECTS*` stay GSL-only (no behavior change for GSL users)
- `MP_UNITS_PRE`/`MP_UNITS_POST` map to C++26 `pre`/`post` specifiers on
function declarations (piloted on `basic_fixed_string` element access)
- `MP_UNITS_PRE_BODY*` are the native-only in-body workaround for
functions whose `pre()` predicates GCC cannot constant-evaluate yet
- `MP_UNITS_PRECONDITION*` aggregate the two so a check is emitted by
whichever backend is active; all unpaired in-body precondition sites
migrated to them
- `contract_assert` is used only at runtime; during constant evaluation a
violation poisons the constant expression instead (GCC 16 fails to
constant-evaluate contract predicates in many valid contexts)
- `contracts=std` composes with `import_std` and `freestanding` (the old
restrictions applied only to third-party GSL headers); a freestanding
application has to provide a contract-violation handler or compile with
`-fcontract-evaluation-semantic=quick_enforce`
- `INTMAX_MAX` replaced with `std::numeric_limits` in contract predicates
(the macro is unavailable with `import std;`)
- CI job matrix learns C++26 (`max_std` per toolchain) and guarantees
`contracts=std` coverage on supporting toolchains; `check_all.sh` gcc16
row now exercises `import_std` together with `std` contracts
Resolves#682
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(ci): make C++26 contracts jobs pass on the CI toolchains
- hide the runtime `contract_assert` behind the non-constexpr
`detail::runtime_contract_check()` helper - some GCC 16 snapshots (e.g.
20260315 used by CI) fail to constant-evaluate contract assertions even
in the not-taken branch of `if consteval`, and a non-constexpr function
body is invisible to the constant evaluator
- disable the freestanding `contracts=std` CI coverage until the upstream
libstdc++ regression is fixed (current GCC 16 snapshots reject
`-ffreestanding` with `-std=c++26` for any contracts setting)
- `check_all.sh` skips configurations for which the environment provides
no Conan profile yet (the devcontainer image has no gcc16 profile)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: remove the todo/ design note from the repository
The todo/ directory is local-only and must never be committed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
0 commit comments