Landing: e8207be46a6e

Project / Subsystem

gcc / c++/contracts

Date

2026-09-20

Author

Joshua Berne

Commit

e8207be46a6ebbbc079adc72c763b648de5c2da5

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
c++/contracts
patch_id
—
commit_hash
e8207be46a6ebbbc079adc72c763b648de5c2da5
source_type
github
headline
Fix return object cleanup for functions with C++26 contracts.
tldr
Corrects double destruction of return objects in C++26 functions with contracts by managing sentinel declarations.
author
Joshua Berne
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • c++
  • • contracts
  • • bugfix
discussion_id_link
—
bugzilla_pr
—
date
2026-09-20T00:00:00.000Z

This commit addresses an issue in C++26 contract handling where the return value of a function could be destroyed twice, or an internal compiler error (ICE) could occur. The problem arose from creating an artificial block for contract assertions which duplicated cleanup code. The fix involves overriding the return value sentinel management within this artificial block to ensure proper cleanup.