[clang] [Sema] Reject unqualified lookup of local nested class name (PR #192678)
Yanzuo Liu via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 20 09:48:15 PDT 2026
================
----------------
zwuis wrote:
> ... `isNamespaceOrTranslationUnitScope` since `S` comes under the translation unit scope in the global declarations and as a result of which class members are not visited and members like `A::B` are not considered during unqualified lookup which correctly produces the error message.
Yeah. After the loop
https://github.com/llvm/llvm-project/blob/58fb00f887ae71cc1af80cb572df4a2622586143/clang/lib/Sema/SemaLookup.cpp#L1346-L1350
where you add `if`, we reach
https://github.com/llvm/llvm-project/blob/58fb00f887ae71cc1af80cb572df4a2622586143/clang/lib/Sema/SemaLookup.cpp#L1499-L1503
, which is similar to the former loop. But the latter loop doesn't find
```cpp
struct A { struct B; };
struct A::B {};
B b; // doesn't find 'B'
```
correctly.
We can explore the difference between these two loops handling these two cases (in global scope and local scope) and then decide where to modify (perhaps not modifying lookup implementation).
https://github.com/llvm/llvm-project/pull/192678
More information about the cfe-commits
mailing list