]> granicus.if.org Git - clang/commitdiff
In Microsoft mode, don't perform typo correction in a template member function depend...
authorFrancois Pichet <pichet2000@gmail.com>
Sat, 3 Dec 2011 15:55:29 +0000 (15:55 +0000)
committerFrancois Pichet <pichet2000@gmail.com>
Sat, 3 Dec 2011 15:55:29 +0000 (15:55 +0000)
Basically typo correction will try to offer a correction instead of looking into type dependent base classes.

I found this problem while parsing Microsoft ATL code with clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145772 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaLookup.cpp
test/SemaTemplate/ms-lookup-template-base-classes.cpp

index c232515ef365623da3d8e11e4a991034f0341001..9f1e9a5516b397c182c025b8b9d8216f6c43b2ce 100644 (file)
@@ -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)
index 901f104ec3656d922f5ed69b8890a46cdf1d8d8d..2c422dc7e3f7e905feb3509a80b27a88643cec58 100644 (file)
@@ -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>;
+
+}