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
This commit is contained in:
John McCall 2009-12-19 02:05:44 +00:00
Родитель b381441bfb
Коммит 410a3f3c19
2 изменённых файлов: 15 добавлений и 0 удалений

Просмотреть файл

@ -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);

Просмотреть файл

@ -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>();
}
};
}