https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124648
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Iain D Sandoe <[email protected]>: https://gcc.gnu.org/g:a8234bec74bda4ae1e507e1706053a5d781a4aa6 commit r16-8763-ga8234bec74bda4ae1e507e1706053a5d781a4aa6 Author: Iain Sandoe <[email protected]> Date: Sun Apr 5 20:45:32 2026 +0530 c++, contracts: Account for lambda captures in pre/post [PR124648]. When we have lambda captures, they appear in the vars slot of a bind expression at the outer operator() body. We need these to be visible for any pre or post conditions that might use them, therefore (when a lambda has captures) nest the application of contract pre and post conditions within the lambda outer bind expressino. PR c++/124648 gcc/cp/ChangeLog: * contracts.cc (maybe_apply_function_contracts): Nest pre and post conditions inside the outer bind expression of a lambda with captures. gcc/testsuite/ChangeLog: * g++.dg/contracts/cpp26/expr.prim.lambda.closure.p10.C: Update to include tests of conditions seen in PR124648. Signed-off-by: Iain Sandoe <[email protected]>
