[clang] [clang] Fix incorrect 'namespace' in diagnostic for out-of-line declarations (PR #230630)
Yanzuo Liu via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 29 19:17:03 PDT 2026
================
@@ -6469,9 +6469,22 @@ bool Sema::diagnoseQualifiedDeclaration(CXXScopeSpec &SS, DeclContext *DC,
// The cases that DC is not NamespaceDecl should be handled in
// CheckRedeclarationExported.
return false;
- } else
+ } else {
+ unsigned DCKind = diag::EnclosingDeclKind::Namespace;
----------------
zwuis wrote:
I think IILE is slightly better.
```cpp
unsigned DCKind = [&]{
if (auto *TD = dyn_cast<TagDecl>(DC)) {
switch (TD->getTagKind()) { ... }
}
assert(isa<NamespaceDecl>(DC));
return ...;
}();
```
https://github.com/llvm/llvm-project/pull/230630
More information about the cfe-commits
mailing list