P3400

Controlling Contract-Assertion Properties

R5

C++26 Contracts, adopted with [P2900R14], provides a framework for specifying and checking contract assertions whose behavior is controlled through implementation-defined build configurations. This paper introduces *assertion-control* *objects* — compile-time objects, composed from `constexpr` *labels*, that let developers customize contract-assertion behavior directly in C++ source code. Labels participate in independently opt-in *facets* that expose hooks to customize every aspect of contract-assertion evaluation and violation handling behavior. Accompanying Standard Library additions provide ready-made labels covering the most common use cases, while the underlying framework is designed to be extended with user-defined labels and new facets over time. The functionality enabled by this proposal is essential to the unhindered and widespread adoption of Contracts across the many domains in which C++ is used.

Authors
Joshua Berne
Mailing
2026-10
Doc date
2026-10-23
Audience
EWG

Revision history

  1. 2026-10
    R5 Selected (shown above)
  2. 2026-07
    R4 EWG

    Controlling Contract-Assertion Properties

  3. 2026-05
    R3 EWG

    Controlling Contract-Assertion Properties