summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaLookup.cpp7
-rw-r--r--clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp20
2 files changed, 27 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index c232515ef36..9f1e9a5516b 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -3556,6 +3556,13 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName,
if (Diags.hasFatalErrorOccurred() || !getLangOptions().SpellChecking)
return TypoCorrection();
+ // In Microsoft mode, don't perform typo correction in a template member
+ // function dependent context because it interferes with the "lookup into
+ // dependent bases of class templates" feature.
+ if (getLangOptions().MicrosoftMode && CurContext->isDependentContext() &&
+ isa<CXXMethodDecl>(CurContext))
+ return TypoCorrection();
+
// We only attempt to correct typos for identifiers.
IdentifierInfo *Typo = TypoName.getName().getAsIdentifierInfo();
if (!Typo)
diff --git a/clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp b/clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp
index 901f104ec36..2c422dc7e3f 100644
--- a/clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp
+++ b/clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp
@@ -123,3 +123,23 @@ int main2()
}
}
+
+
+namespace lookup_dependent_base_no_typo_correction {
+
+class C {
+public:
+ int m_hWnd;
+};
+
+template <class T>
+class A : public T {
+public:
+ void f(int hWnd) {
+ m_hWnd = 1;
+ }
+};
+
+template class A<C>;
+
+}
OpenPOWER on IntegriCloud