diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 7 | ||||
| -rw-r--r-- | clang/test/SemaCXX/typo-correction-pt2.cpp | 16 |
2 files changed, 23 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 8a5c0a5ba7e..1a47340d69a 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -4210,6 +4210,12 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName, KNI != KNIEnd; ++KNI) Namespaces.AddNameSpecifier(KNI->first); + bool SSIsTemplate = false; + if (NestedNameSpecifier *NNS = + (SS && SS->isValid()) ? SS->getScopeRep() : 0) { + if (const Type *T = NNS->getAsType()) + SSIsTemplate = T->getTypeClass() == Type::TemplateSpecialization; + } for (ASTContext::type_iterator TI = Context.types_begin(), TIEnd = Context.types_end(); TI != TIEnd; ++TI) { @@ -4217,6 +4223,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName, CD = CD->getCanonicalDecl(); if (!CD->isDependentType() && !CD->isAnonymousStructOrUnion() && !CD->isUnion() && CD->getIdentifier() && + (SSIsTemplate || !isa<ClassTemplateSpecializationDecl>(CD)) && (CD->isBeingDefined() || CD->isCompleteDefinition())) Namespaces.AddNameSpecifier(CD); } diff --git a/clang/test/SemaCXX/typo-correction-pt2.cpp b/clang/test/SemaCXX/typo-correction-pt2.cpp index 65d961085a8..1738bb41b91 100644 --- a/clang/test/SemaCXX/typo-correction-pt2.cpp +++ b/clang/test/SemaCXX/typo-correction-pt2.cpp @@ -207,3 +207,19 @@ struct { int y = x; // expected-error-re {{use of undeclared identifier 'x'{{$}}}} } + +namespace PR18685 { +template <class C, int I, int J> +class SetVector { + public: + SetVector() {} +}; + +template <class C, int I> +class SmallSetVector : public SetVector<C, I, 8> {}; + +class foo {}; +SmallSetVector<foo*, 2> fooSet; +} + +PR18685::BitVector Map; // expected-error-re {{no type named 'BitVector' in namespace 'PR18685'{{$}}}} |

