Landing: 58f3920e31f3

Project / Subsystem

gcc / c++/contracts

Date

2026-08-14

Author

Wang Jinghao

Commit

58f3920e31f3c436e1d6f9cbd2e2c93c152cc35a

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
c++/contracts
patch_id
—
commit_hash
58f3920e31f3c436e1d6f9cbd2e2c93c152cc35a
source_type
github
headline
C++ contracts template postconditions rebuild logic improved.
tldr
Avoids unnecessary rebuilding of template postconditions if still processing a template declaration.
author
Wang Jinghao
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • c++
  • • contracts
  • • templates
  • • compiler-error
discussion_id_link
—
bugzilla_pr
—
date
2026-08-14T00:00:00.000Z

This commit refactors the rebuild_postconditions logic in GCC’s C++ contract handling to prevent unnecessary rebuilding when still processing a template declaration. Previously, the function used tsubst_expr to replace placeholder return variables, but passing an empty template argument vector could lead to an Internal Compiler Error (ICE) if template parameters were directly referenced. The fix ensures that if the compiler is currently processing a template declaration, the postcondition rebuilding is skipped, as it will be handled correctly during template instantiation.