Fix PR4365.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73240 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaInherit.cpp b/lib/Sema/SemaInherit.cpp
index 1b968f0..28ca5f6 100644
--- a/lib/Sema/SemaInherit.cpp
+++ b/lib/Sema/SemaInherit.cpp
@@ -138,6 +138,12 @@
     // Find the record of the base class subobjects for this type.
     QualType BaseType = Context.getCanonicalType(BaseSpec->getType());
     BaseType = BaseType.getUnqualifiedType();
+
+    // If a base class of the class template depends on a template-parameter, 
+    // the base class scope is not examined during unqualified name lookup.
+    // [temp.dep]p3.
+    if (BaseType->isDependentType())
+      continue;
     
     // Determine whether we need to visit this base class at all,
     // updating the count of subobjects appropriately.