Landing: f9d1e2285ac3
Project / Subsystem
gcc / c++
Date
2026-07-05
Author
Ville Voutilainen
Commit
f9d1e2285ac37051915437ba461ac4987588e7ab
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- c++
- patch_id
- —
- commit_hash
- f9d1e2285ac37051915437ba461ac4987588e7ab
- source_type
- github
- headline
- C++ contract assertions now have side effects.
- tldr
- Contract assertions in C++26 are now marked as having side effects, aligning with their behavior and fixing PR125904.
- author
- Ville Voutilainen
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • c++
- • contracts
- • compiler
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-07-05T00:00:00.000Z
This commit modifies the C++ compiler’s handling of contract assertions for C++26, as specified in PR125904. The build_contract_check function in contracts.cc now correctly sets the TREE_SIDE_EFFECTS flag for contract checks. This ensures that compiler optimizations do not incorrectly discard these assertions, preserving their intended behavior.