Landing: 4d26b4cc14c1
Project / Subsystem
gcc / c++/contracts
Date
2026-08-14
Author
Wang Jinghao
Commit
4d26b4cc14c1db94062240a69bffdbe3e2aa5904
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- c++/contracts
- patch_id
- —
- commit_hash
- 4d26b4cc14c1db94062240a69bffdbe3e2aa5904
- source_type
- github
- headline
- C++ contracts regeneration from templates is now always performed.
- tldr
- C++ contracts are now always regenerated from the current code pattern in templates, resolving issues with explicit instantiations.
- author
- Wang Jinghao
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • c++
- • contracts
- • templates
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-08-14T00:00:00.000Z
This commit ensures that C++ contracts are always regenerated from the current code pattern within regenerate_decl_from_template() when either the declaration or the pattern has contracts. This addresses an issue where uninstantiated contracts associated with a function template instantiation could incorrectly refer to parameter declarations from an earlier definition if an explicit instantiation was encountered before a later redeclaration. By always regenerating from the current pattern, the compiler ensures that contracts accurately reflect the latest definition, preventing potential errors related to stale parameter references.