]> granicus.if.org Git - clang/commitdiff
Unresolved implicit member accesses are dependent if the object type is dependent.
authorJohn McCall <rjmccall@apple.com>
Sat, 19 Dec 2009 02:05:44 +0000 (02:05 +0000)
committerJohn McCall <rjmccall@apple.com>
Sat, 19 Dec 2009 02:05:44 +0000 (02:05 +0000)
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

lib/Sema/SemaExpr.cpp
test/SemaTemplate/member-access-expr.cpp

index 7030b7f597b50a86a6c44ee2cc9a81fedf502721..791948fb2b286158f5e8b3d5bfebd69df6e3a340 100644 (file)
@@ -2417,6 +2417,7 @@ Sema::BuildMemberReferenceExpr(ExprArg Base, QualType BaseExprType,
   // result.
   if (R.isOverloadedResult() || R.isUnresolvableResult()) {
     bool Dependent =
+      BaseExprType->isDependentType() ||
       R.isUnresolvableResult() ||
       UnresolvedLookupExpr::ComputeDependence(R.begin(), R.end(), TemplateArgs);
 
index 51de64a3b4770b2ef82c11de13075dca2620ed7c..116e8377b366ea5aa7d12369214ecd7058d2044d 100644 (file)
@@ -105,3 +105,17 @@ void test_X5(X5<X4> x5, X5<const X4> x5c, X4 *xp, const X4 *cxp) {
   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>();
+    }
+  };
+}