On 3/23/22 10:29, Patrick Palka wrote:
I wonder if it'd be worthwhile to also test dependent_type_p (scope) here here to avoid iterating over the lookup set when it can't possibly contain a dependent using-decl.
Good thought:
From b1005f60c17d693e9fbc38a9481b3cd896d26785 Mon Sep 17 00:00:00 2001 From: Jason Merrill <ja...@redhat.com> Date: Wed, 23 Mar 2022 12:22:20 -0400 Subject: [PATCH] c++: tweak PR105006 fix To: gcc-patches@gcc.gnu.org Checking dependent_type_p avoids needing to walk the overloads in cases where it would not be possible to find a dependent using. PR c++/105006 gcc/cp/ChangeLog: * name-lookup.cc (lookup_using_decl): Check that scope is a dependent type before looking for dependent using. --- gcc/cp/name-lookup.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc index ea947fabb7e..3c7b626350f 100644 --- a/gcc/cp/name-lookup.cc +++ b/gcc/cp/name-lookup.cc @@ -5667,7 +5667,7 @@ lookup_using_decl (tree scope, name_lookup &lookup) /* If the lookup in the base contains a dependent using, this using is also dependent. */ - if (!dependent_p && lookup.value) + if (!dependent_p && lookup.value && dependent_type_p (scope)) { tree val = lookup.value; if (tree fns = maybe_get_fns (val)) -- 2.27.0