c++: ICE with USING_DECL redeclaration [PR98687]
authorMarek Polacek <polacek@redhat.com>
Fri, 15 Jan 2021 03:14:38 +0000 (22:14 -0500)
committerMarek Polacek <polacek@redhat.com>
Tue, 19 Jan 2021 22:13:00 +0000 (17:13 -0500)
commitd89b00c095e99cd5cb6d3e05f30d3a61fa592000
tree88c70d0ec39f9ee8978aea8ff133a4deed603301
parent9693e255ee2536c6823640eba5d0163c2b401161
c++: ICE with USING_DECL redeclaration [PR98687]

My recent patch that introduced push_using_decl_bindings didn't
handle USING_DECL redeclaration, therefore things broke.  This patch
amends that by breaking out a part of finish_nonmember_using_decl
out to a separate function, push_using_decl_bindings, and calling it.
It needs an overload, because name_lookup is only available inside
of name-lookup.c.

gcc/cp/ChangeLog:

PR c++/98687
* name-lookup.c (push_using_decl_bindings): New, broken out of...
(finish_nonmember_using_decl): ...here.
* name-lookup.h (push_using_decl_bindings): Update declaration.
* pt.c (tsubst_expr): Update the call to push_using_decl_bindings.

gcc/testsuite/ChangeLog:

PR c++/98687
* g++.dg/lookup/using64.C: New test.
* g++.dg/lookup/using65.C: New test.
gcc/cp/name-lookup.c
gcc/cp/name-lookup.h
gcc/cp/pt.c
gcc/testsuite/g++.dg/lookup/using64.C [new file with mode: 0644]
gcc/testsuite/g++.dg/lookup/using65.C [new file with mode: 0644]