]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: ICE with using-decl [PR 99238]
authorNathan Sidwell <nathan@acm.org>
Fri, 12 Mar 2021 17:02:41 +0000 (09:02 -0800)
committerNathan Sidwell <nathan@acm.org>
Fri, 12 Mar 2021 18:23:05 +0000 (10:23 -0800)
commit6e885ad3287388192e52e9b524dbaa408507c0a4
tree7e95fc65bdaa8414b29907489f09ec61cff00f9f
parentd8b84e2771fc2495493d0c66c3cba714484757d7
c++: ICE with using-decl [PR 99238]

This ICE was caused by a stray TREE_VISITED marker.  The lookup
machinery was leaving it there due to the way I'd arranged for it to
be cleared.  That was presuming the name_lookup::value field didn't
change, and that wasn't always true in the using-decl processing.  I
took the opportunity to break out a helper, and then call it
immediately after lookups, rather than wait until destructor time.
Added some asserts the module machinery to catch further cases of
this.

PR c++/99238
gcc/cp/
* module.cc (depset::hash::add_binding_entity): Assert not
visited.
(depset::add::add_specializations): Likewise.
* name-lookup.c (name_lookup::dedup): New.
(name_lookup::~name_lookup): Assert not deduping.
(name_lookup::restore_state): Likewise.
(name_lookup::add_overload): Replace outlined code with dedup
call.
(name_lookup::add_value): Likewise.
(name_lookup::search_namespace_only): Likewise.
(name_lookup::adl_namespace_fns): Likewise.
(name_lookup::adl_class_fns): Likewise.
(name_lookup::search_adl): Likewise.  Add clearing dedup call.
(name_lookup::search_qualified): Likewise.
(name_lookup::search_unqualified): Likewise.
gcc/testsuite/
* g++.dg/modules/pr99238.h: New.
* g++.dg/modules/pr99238_a.H: New.
* g++.dg/modules/pr99238_b.H: New.
gcc/cp/module.cc
gcc/cp/name-lookup.c
gcc/testsuite/g++.dg/modules/pr99238.h [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/pr99238_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/pr99238_b.H [new file with mode: 0644]