On Tue, Jun 04, 2019 at 11:13:14AM -0400, Nathan Sidwell wrote: > - /* Type found, check if it is in the allowed scopes, ignoring cleanup > - and template parameter scopes. */ > - if (val) > + if (b->kind != sk_namespace) > + /* Look in non-namespace scopes. */ > + for (cxx_binding *iter = NULL; > + (iter = outer_binding (name, iter, /*class_p=*/ true)); ) > + { > + /* First check we're supposed to be looking in this scope -- > + if we're not, we're done. */ > + for (; b != iter->scope; b = b->level_chain) > + if (!(b->kind == sk_cleanup > + || b->kind == sk_template_parms > + || b->kind == sk_function_parms > + || (b->kind == sk_class > + && scope == ts_within_enclosing_non_class))) > + return NULL_TREE;
[...] > + /* Now check if we can look in namespace scope. */ > + for (; b->kind != sk_namespace; b = b->level_chain) > + if (!(b->kind == sk_cleanup > + || b->kind == sk_template_parms > + || b->kind == sk_function_parms > + || (b->kind == sk_class > + && scope == ts_within_enclosing_non_class))) > + return NULL_TREE; Looks like we could break that out into a new predicate function? Something like allowed_scope_p? Marek