[clang] [Sema] Reject unqualified lookup of local nested class name (PR #192678)

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 21 01:47:39 PDT 2026


================

----------------
arrowten wrote:

Hi @zwuis, as far as I understood, the first `for` is doing the local scope lookup while the second is doing the global scope lookup and I tried implementing another fix by applying it in the first `for` after this code
```
for (; S && !isNamespaceOrTranslationUnitScope(S); S = S->getParent()) {
    bool SearchNamespaceScope = true;
    // Check whether the IdResolver has anything in this scope.
    for (; I != IEnd && S->isDeclScope(*I); ++I) {
      if (NamedDecl *ND = R.getAcceptableDecl(*I)) {
```
which eventually helped to give out the error for 
```
void f() {
  struct A { struct B; };
  struct A::B {};
  B b;
}
```
but then it failed for other tests in the test directory. So if you still want some other fix, I would like to have a call with you on where can I do the potential searches since I am new to this. Thanks.

https://github.com/llvm/llvm-project/pull/192678


More information about the cfe-commits mailing list