When a function is declared in the same scope as a class with the same name then the function hides that class. Currently this is done by a single check after the main loop in LookupResult::resolveKind, but this can give the wrong result when we have a using declaration in multiple namespace scopes in two different ways:
- When the using declaration is hidden in one namespace but not the other we can end up considering only the hidden one when deciding if the result is ambiguous, causing an incorrect "not ambiguous" result.
- When two classes with the same name in different namespace scopes are both hidden by using declarations this can result in incorrectly deciding the result is ambiguous. There's currently a comment saying this is expected, but I don't think that's correct.
Solve this by checking each Decl to see if it's hidden by some other Decl in the same scope. This means we have to delay removing anything from Decls until after the main loop, in case a Decl is hidden by another that is removed due to being non-unique.
This section does not exist anymore, it was replaced in p1787 which resolved a very large number of DRs and reflector discussions. I have not fully digested the paper myself but this change should reflect the new wording as it exists in the current draft.