]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Don't strip USING_DECLs when updating local bindings [PR116748]
authorNathaniel Shead <nathanieloshead@gmail.com>
Thu, 19 Sep 2024 14:05:04 +0000 (00:05 +1000)
committerNathaniel Shead <nathanieloshead@gmail.com>
Fri, 27 Sep 2024 23:00:31 +0000 (09:00 +1000)
commitb9ac51a843f9dc807b00ab7f49f64968807a4ee8
tree7534ce11573ba24cc239711f7c3d0643ecba1801
parentcf9efe5ec14fea3ad5746fbefb22544bb9424d9d
c++: Don't strip USING_DECLs when updating local bindings [PR116748]

Currently update_binding strips USING_DECLs too eagerly, leading to ICEs
in pop_local_decl as it can't find the decl it's popping in the binding
list.  Let's rather try to keep the original USING_DECL around.

This also means that using59.C can point to the location of the
using-decl rather than the underlying object directly; this is in the
direction required to fix PR c++/106851 (though more work is needed to
emit properly helpful diagnostics here).

PR c++/116748

gcc/cp/ChangeLog:

* name-lookup.cc (update_binding): Maintain USING_DECLs in the
binding slots.

gcc/testsuite/ChangeLog:

* g++.dg/lookup/using59.C: Update location.
* g++.dg/lookup/using69.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/name-lookup.cc
gcc/testsuite/g++.dg/lookup/using59.C
gcc/testsuite/g++.dg/lookup/using69.C [new file with mode: 0644]