Landing: a085455306ec

Project / Subsystem

gcc / c++

Date

2026-07-01

Author

Jason Merrill

Commit

a085455306ec4aa15a11efacd994968bf951f7b6

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
c++
patch_id
commit_hash
a085455306ec4aa15a11efacd994968bf951f7b6
source_type
github
headline
C++: co_await and structured bindings: Fix guard variable lifetime.
tldr
Structured bindings used with `co_await` now correctly manage temporary guard variables.
author
Jason Merrill
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • c++
  • coroutines
  • structured bindings
discussion_id_link
bugzilla_pr
date
2026-07-01T00:00:00.000Z

This commit fixes an issue where temporary guard variables controlling the cleanup of structured binding variables were not surviving across co_await expressions. The problem stemmed from using TARGET_EXPR, which has a limited lifetime, to hold values that needed to persist as long as the structured binding itself. The solution uses get_temp_regvar for these guards and manually pushdecls them to ensure visibility and correct lifetime management, resolving PR124584.