Landing: 4491ee5688d0

Project / Subsystem

gcc / c++

Date

2026-05-21

Author

Jason Merrill

Commit

4491ee5688d0bcd69956af4126e9e4643d951178

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
c++
patch_id
commit_hash
4491ee5688d0bcd69956af4126e9e4643d951178
source_type
github
headline
'this' capture in template
tldr
Fixed an issue where the 'const' qualifier was dropped from 'this' capture proxies in templates.
author
Jason Merrill
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • c++
  • lambda
  • templates
  • bugfix
discussion_id_link
bugzilla_pr
date
2026-05-21T00:00:00.000Z

This commit fixes an issue in C++ lambda expressions where the ‘const’ qualifier was being dropped from the capture proxy when capturing ‘this’ in a template. This could lead to incorrect code generation when the captured ‘this’ pointer was expected to be const. The fix ensures that the capture proxy retains the ‘const’ qualifier, maintaining the correctness of ‘this’ capture in templates.