https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115605
--- Comment #8 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:cf588f1a8e7406ced5b08f32f9d23f015a240a31 commit r16-1350-gcf588f1a8e7406ced5b08f32f9d23f015a240a31 Author: Iain Sandoe <i...@sandoe.co.uk> Date: Mon Jun 2 09:42:23 2025 +0100 c++: Fix template class lookup [PR120495, PR115605]. In the reported issues, using lookup_template_class () directly on (for example) the coroutine_handle identifier fails because a class-local TYPE_DECL is found. This is because, in the existing code, lookup is called with default parameters which means that class contexts are examined first. Fix this, when a context is provided by the caller, by doing lookup in namespace provided. PR c++/120495 PR c++/115605 gcc/cp/ChangeLog: * pt.cc (lookup_template_class): Honour provided namespace contexts when looking up class templates. gcc/testsuite/ChangeLog: * g++.dg/coroutines/pr120495.C: New test. * g++.dg/pr115605.C: New test. Signed-off-by: Iain Sandoe <i...@sandoe.co.uk>