c++: More set_identifier_type_value fixing [PR 99116]
My recent change looked under template_parms in two places, but that
was covering up a separate problem. We were attempting to set the
identifier_type_value of a template_parm into the template_parm
scope. The peeking stopped us doing that, but confused poplevel,
leaving an identifier value lying around. This fixes the underlying
problem in do_pushtag -- we only need to set the identifier_type_value
directly when we're in a template_parm scope (a later pushdecl will
push the actual template_decl). for non-class non-template-parm
bindings do_pushdecl already ends up manipulating
identifier_type_value correctly.
PR c++/99116
gcc/cp/
* name-lookup.c (do_pushdecl): Don't peek under template_parm
bindings here ...
(set_identifier_type_value_with_scope): ... or here.
(do_pushtag): Only set_identifier_type_value_with_scope at
non-class template parm scope, and use parent scope.
gcc/testsuite/
* g++.dg/lookup/pr99116-1.C: New.
* g++.dg/lookup/pr99116-2.C: New.