Contracts Sink C++26: First Draft Rejected at Final Vote Since 1998
The C++26 international standard draft failed to pass the national delegation vote on October 23.
This is the first time since the language was standardized in 1998 that it has reached the final step and been sent back.
A standard goes through several rounds of voting. The earlier rounds are internal technical votes within the committee. The final hurdle is called DIS, where member-state delegations vote on the entire draft.
By convention, reaching this step is usually a formality; nobody expected it to be sent back.
As a result, on October 23 this hurdle was not passed, and the entire draft was sent back for revision.
After this step there is only the publication process, so it has always been the most stable link in the whole chain. The only previous case of this kind was the C++/CLI language specification in 2006.
The sticking point is called Contracts programming. The English name is Contracts. The idea is to write "what must be satisfied before entering" and "what is guaranteed after exiting" for functions, and the compiler can check them based on switches.
For people writing business code, what it does is turn the comment "the pointer passed in cannot be null" into part of the code. When parameters don't conform, it's handled according to compilation options: it can be fully disabled, only logged, or directly aborted.
The syntax looks like this, with conditions attached directly after function parameters:
int get_value(const std::vector<int>& values, std::size_t index)
pre(index < values.size())
{
return values[index];
}
If the index is out of bounds, it's handled according to compilation options: it can abort directly, or just log a violation message and continue running.
Return values can also be constrained, written like post(result: result >= low && result <= high). Inside the function body, contract_assert can be inserted to check whether a certain step holds.
One thing to note: contracts are not input validation. Data passed in by users still needs to be judged yourself.
It's more useful for people writing libraries. Conditions are written on the function signature, the compiler knows which checks always hold, and at runtime one less layer of checking is needed.
The trouble is also here: the stricter the checks, the less optimization space. The two goals pull against each other, which is why the proposal has become so complicated.
A dedicated research group was set up for this feature in 2020. After four or five years of work, when the committee passed the entire draft in March 2026, it was included.
So this time it wasn't a technical proposal being rejected at the last minute; it was the political-level vote that stopped it.
An international standard is one complete document, voted on once, not split into individual items.
What was rejected is the entire draft. The accompanying static reflection, concurrent execution framework, and hundreds of small improvements nobody objected to all have to wait together.
The opposition also has a formal document.
Three committee members wrote a paper called "Contract concerns", listing point by point their unease with the proposal.
There are two paths forward.
Either modify the details of contracts and vote again, or simply remove the feature entirely.
Either way, reflection and the concurrent framework will have to keep waiting, and the C++26 timeline will be pushed back.
This language will not die because of this. Compiler vendors will continue shipping versions, and existing code doesn't need a single line changed.
It's just that before the standard is finalized, nobody can publicly claim full C++26 support. The version number on marketing pages has to keep hanging there.
The cost is that reflection, which people have waited over a decade for, continues to wait, and "making C++ safer" is pushed back at least one version cycle.
Meanwhile Rust doesn't need votes on that side, moving forward version by version.
For people currently choosing a technology stack, this is a new reason.
Hacker News discussion: https://news.ycombinator.com/item?id=50360164.
How many C++ projects do you still have on your hands? Feel free to say in the comments.
About me:
- Rural programmer (
returned to the countryside in 2020, hasn't left the village since) - Independent developer (
dedicated to developing 1000 small products) - Technology observer (
sharing programming technology, industry news, etc.) - Frontend Tiger Chen Suiyi (
self-appointed) - My website is:
https://yicode.tech
Top 3 of 5 from juejin.cn, machine-translated. The original thread is authoritative.
Thanks for sharing 👍
[fist-and-palm salute]
Honestly never imagined a single Contracts feature would drag down the entire draft.
Completely unexpected.
Still don't understand why it's being opposed.