]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Fix template class lookup [PR120495, PR115605].
authorIain Sandoe <iain@sandoe.co.uk>
Mon, 2 Jun 2025 08:42:23 +0000 (09:42 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Mon, 9 Jun 2025 22:08:04 +0000 (23:08 +0100)
commitcf588f1a8e7406ced5b08f32f9d23f015a240a31
tree7ca243a37479a20a502b2cee4959d0e3642a337f
parente825ec7fcd81cf845bc6f926d07917b6040a585d
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 <iain@sandoe.co.uk>
gcc/cp/pt.cc
gcc/testsuite/g++.dg/coroutines/pr120495.C [new file with mode: 0644]
gcc/testsuite/g++.dg/pr115605.C [new file with mode: 0644]