Thanks! Could you try this one instead? I think it's more representative of 
what we should do, i.e. only fall back if we're in a CXXRecordDecl and said 
record has dependent bases.

http://reviews.llvm.org/D4854

Files:
  lib/Sema/SemaCXXScopeSpec.cpp
  test/SemaTemplate/ms-lookup-template-base-classes.cpp

Index: lib/Sema/SemaCXXScopeSpec.cpp
===================================================================
--- lib/Sema/SemaCXXScopeSpec.cpp
+++ lib/Sema/SemaCXXScopeSpec.cpp
@@ -703,8 +703,11 @@
   if (getLangOpts().MSVCCompat) {
     DeclContext *DC = LookupCtx ? LookupCtx : CurContext;
     if (DC->isDependentContext() && DC->isFunctionOrMethod()) {
-      SS.Extend(Context, &Identifier, IdentifierLoc, CCLoc);
-      return false;
+      CXXRecordDecl *ContainingClass = 
dyn_cast<CXXRecordDecl>(DC->getParent());
+      if (ContainingClass && ContainingClass->hasAnyDependentBases()) {
+        SS.Extend(Context, &Identifier, IdentifierLoc, CCLoc);
+        return false;
+      }
     }
   }
 
Index: test/SemaTemplate/ms-lookup-template-base-classes.cpp
===================================================================
--- test/SemaTemplate/ms-lookup-template-base-classes.cpp
+++ test/SemaTemplate/ms-lookup-template-base-classes.cpp
@@ -460,3 +460,11 @@
   int x = f<NameFromBase>();
 };
 }
+
+namespace function_template_undef_impl {
+template<class T>
+void f() {
+  Undef::staticMethod(); // expected-error {{use of undeclared identifier 
'Undef'}}
+  UndefVar.method(); // expected-error {{use of undeclared identifier 
'UndefVar'}}
+}
+}
Index: lib/Sema/SemaCXXScopeSpec.cpp
===================================================================
--- lib/Sema/SemaCXXScopeSpec.cpp
+++ lib/Sema/SemaCXXScopeSpec.cpp
@@ -703,8 +703,11 @@
   if (getLangOpts().MSVCCompat) {
     DeclContext *DC = LookupCtx ? LookupCtx : CurContext;
     if (DC->isDependentContext() && DC->isFunctionOrMethod()) {
-      SS.Extend(Context, &Identifier, IdentifierLoc, CCLoc);
-      return false;
+      CXXRecordDecl *ContainingClass = dyn_cast<CXXRecordDecl>(DC->getParent());
+      if (ContainingClass && ContainingClass->hasAnyDependentBases()) {
+        SS.Extend(Context, &Identifier, IdentifierLoc, CCLoc);
+        return false;
+      }
     }
   }
 
Index: test/SemaTemplate/ms-lookup-template-base-classes.cpp
===================================================================
--- test/SemaTemplate/ms-lookup-template-base-classes.cpp
+++ test/SemaTemplate/ms-lookup-template-base-classes.cpp
@@ -460,3 +460,11 @@
   int x = f<NameFromBase>();
 };
 }
+
+namespace function_template_undef_impl {
+template<class T>
+void f() {
+  Undef::staticMethod(); // expected-error {{use of undeclared identifier 'Undef'}}
+  UndefVar.method(); // expected-error {{use of undeclared identifier 'UndefVar'}}
+}
+}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to