[all-commits] [llvm/llvm-project] d031ff: [Sema] Fix handling of functions that hide classes
john-brawn-arm via All-commits
all-commits at lists.llvm.org
Tue Jul 25 04:51:43 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d031ff38779bd688c514136dbdcce3169ee82b6e
https://github.com/llvm/llvm-project/commit/d031ff38779bd688c514136dbdcce3169ee82b6e
Author: John Brawn <john.brawn at arm.com>
Date: 2023-07-25 (Tue, 25 Jul 2023)
Changed paths:
M clang/lib/Sema/SemaLookup.cpp
A clang/test/SemaCXX/using-hiding.cpp
Log Message:
-----------
[Sema] Fix handling of functions that hide classes
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.
Differential Revision: https://reviews.llvm.org/D154503
More information about the All-commits
mailing list