https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119755
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Nathaniel Shead <nsh...@gcc.gnu.org>: https://gcc.gnu.org/g:a6f4178d0d5a51c0de175d282f693f923ffefa27 commit r15-9508-ga6f4178d0d5a51c0de175d282f693f923ffefa27 Author: Nathaniel Shead <nathanielosh...@gmail.com> Date: Sun Apr 13 12:20:37 2025 +1000 c++: Prune lambda captures from more places [PR119755] Currently, pruned lambda captures are still leftover in the function's BLOCK and topmost BIND_EXPR; this doesn't cause any issues for normal compilation, but does break modules streaming as we try to reconstruct a FIELD_DECL that no longer exists on the type itself. PR c++/119755 gcc/cp/ChangeLog: * lambda.cc (prune_lambda_captures): Remove pruned capture from function's BLOCK_VARS and BIND_EXPR_VARS. gcc/testsuite/ChangeLog: * g++.dg/modules/lambda-10_a.H: New test. * g++.dg/modules/lambda-10_b.C: New test. Signed-off-by: Nathaniel Shead <nathanielosh...@gmail.com> Reviewed-by: Jason Merrill <ja...@redhat.com>