Unresolved implicit member accesses are dependent if the object type is dependent.
Avoids an assertion arising during object-argument initialization in overload
resolution.  In theory we can resolve this at definition time if the class
hierarchy for the member is fully known.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91747 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 7030b7f..791948f 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -2417,6 +2417,7 @@
   // result.
   if (R.isOverloadedResult() || R.isUnresolvableResult()) {
     bool Dependent =
+      BaseExprType->isDependentType() ||
       R.isUnresolvableResult() ||
       UnresolvedLookupExpr::ComputeDependence(R.begin(), R.end(), TemplateArgs);
 
diff --git a/test/SemaTemplate/member-access-expr.cpp b/test/SemaTemplate/member-access-expr.cpp
index 51de64a..116e837 100644
--- a/test/SemaTemplate/member-access-expr.cpp
+++ b/test/SemaTemplate/member-access-expr.cpp
@@ -105,3 +105,17 @@
   x5.f(xp);
   x5c.g(cxp);
 }
+
+// In theory we can do overload resolution at template-definition time on this.
+// We should at least not assert.
+namespace test4 {
+  struct Base {
+    template <class T> void foo() {}
+  };
+
+  template <class T> struct Foo : Base {
+    void test() {
+      foo<int>();
+    }
+  };
+}