https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98935
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Iain D Sandoe <ia...@gcc.gnu.org>: https://gcc.gnu.org/g:bd8c7e71f516bae29a5a9e517b266141458f3977 commit r15-6263-gbd8c7e71f516bae29a5a9e517b266141458f3977 Author: Iain Sandoe <i...@sandoe.co.uk> Date: Fri Nov 1 23:30:58 2024 +0000 c++, coroutines:Ensure bind exprs are visited once [PR98935]. Recent changes in the C++ FE and the coroutines implementation have exposed a latent issue in which a bind expression containing a var that we need to capture in the coroutine state gets visited twice. This causes an ICE (from a checking assert). Fixed by adding a pset to the relevant tree walk. Exit the callback early when the tree is not a BIND_EXPR. PR c++/98935 gcc/cp/ChangeLog: * coroutines.cc (register_local_var_uses): Add a pset to the tree walk to avoid visiting the same BIND_EXPR twice. Make an early exit for cases that the callback does not apply. (cp_coroutine_transform::apply_transforms): Add a pset to the tree walk for register_local_vars. gcc/testsuite/ChangeLog: * g++.dg/coroutines/pr98935.C: New test. Signed-off-by: Iain Sandoe <i...@sandoe.co.uk>