What happened

The development of Contracts for C++26 has been marked by persistent debate and multiple iterations. Initially proposed within the C++20 effort, the feature was included in the initial draft but subsequently removed during the Cologne meeting in 2019.

This led to the formation of a study group in 2020 tasked with thoroughly examining Contracts' potential—a process that spanned over four years. The study group presented its findings and proposals to the Evolution Working Group (EWG) in multiple meetings, ultimately contributing to a majority vote for inclusion in C++26. The WG21 body subsequently voted on the C++26 draft in March 2026, solidifying Contracts' place in the standard with another resounding success – though not without some dissenting opinions.

Why it matters

The inclusion of Contracts represents a significant step forward for C++, addressing long-standing concerns about error detection and runtime verification.

This functionality allows developers to specify preconditions, postconditions, and invariants at compile time, enabling earlier and more reliable debugging. The protracted development process underscores the importance of having robust tooling and clear standards to support software development.

But, but, but…

The challenges inherent in standard-setting are often underestimated. Revisions and debates can be lengthy, involving numerous stakeholders and requiring significant effort to reach consensus.

While the final result – Contracts in C++26 – is a victory for proponents of the feature, the journey highlights the complexities involved in shaping future standards.

“The feature was removed from C++20 again during the same meeting, highlighting the protracted and iterative nature of standard development.”
— Dr Non

The counter-take

The reluctance of certain factions to embrace Contracts stems from a concern about increased compile times and the potential complexity introduced into C++ projects – an argument that ultimately proved insufficient to derail the standard's inclusion.

The AI angle

This upgrade represents an asymmetry in the software development lifecycle—the ability to statically verify code against specified contracts, reducing runtime errors and improving reliability. This can be leveraged by AI-powered testing tools for enhanced validation.