[clang] [clang] NestedNameSpecifier typo correction fix (PR #181239)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 13 11:24:59 PST 2026
================
@@ -381,11 +381,17 @@ namespace {
class NestedNameSpecifierValidatorCCC final
: public CorrectionCandidateCallback {
public:
- explicit NestedNameSpecifierValidatorCCC(Sema &SRef)
- : SRef(SRef) {}
+ explicit NestedNameSpecifierValidatorCCC(Sema &SRef, bool HasQualifier)
+ : SRef(SRef), HasQualifier(HasQualifier) {}
bool ValidateCandidate(const TypoCorrection &candidate) override {
- return SRef.isAcceptableNestedNameSpecifier(candidate.getCorrectionDecl());
+ const NamedDecl *ND = candidate.getCorrectionDecl();
+ if (!SRef.isAcceptableNestedNameSpecifier(ND))
+ return false;
+ // A template type parameter cannot have a nested name specifier.
+ if (HasQualifier && isa<TemplateTypeParmDecl>(ND))
----------------
shafik wrote:
This has four cases but we only have one test, we should really have four tests that cover all combinations to ensure it works as expected.
https://github.com/llvm/llvm-project/pull/181239
More information about the cfe-commits
mailing list