1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 511108 - Do not attempt to resolve the name in an EvalID if the name owner is still dependent

Change-Id: I63dcfa4413569554f30be0c6a94c2b1691515aa4
This commit is contained in:
Nathan Ridge 2017-01-26 22:14:00 -05:00
parent 8c7c06646b
commit fbc18a270f
2 changed files with 43 additions and 3 deletions

View file

@ -10050,7 +10050,43 @@ public class AST2TemplateTests extends AST2TestBase {
// MyContainer c;
// reverse(c); // Ambiguous
// }
public void testWaldo_510834() throws Exception {
public void testSFINAEInEvalIdWithFieldOwner_510834() throws Exception {
parseAndCheckBindings();
}
// template <typename, typename>
// struct is_same {
// static constexpr bool value = false;
// };
//
// template <typename T>
// struct is_same<T, T> {
// static constexpr bool value = true;
// };
//
// template <bool C, typename>
// struct enable_if {};
//
// template <typename R>
// struct enable_if<true, R> {
// typedef R type;
// };
//
// template <typename, typename>
// struct arg {};
//
// template <typename>
// struct param {
// template<typename I>
// param(arg<I, typename enable_if<is_same<I, int>::value, int>::type>&) {}
// };
//
// void foo(param<int>);
//
// void bar(arg<int, int>& x) {
// foo(x);
// }
public void testInstantiationOfEvalIdWithFieldOwner_511108() throws Exception {
parseAndCheckBindings();
}
}

View file

@ -369,15 +369,19 @@ public class EvalID extends CPPDependentEvaluation {
if (templateArgs == fTemplateArgs && fieldOwner == fFieldOwner && nameOwner == fNameOwner)
return this;
boolean nameOwnerStillDependent = false;
if (nameOwner instanceof ICPPClassType) {
ICPPEvaluation eval = resolveName((ICPPClassType) nameOwner, null, templateArgs, null, context.getPoint());
if (eval != null)
return eval;
if (!CPPTemplates.isDependentType((ICPPClassType) nameOwner))
if (CPPTemplates.isDependentType((ICPPClassType) nameOwner)) {
nameOwnerStillDependent = true;
} else {
return EvalFixed.INCOMPLETE;
}
}
if (fieldOwner != null && !fieldOwner.isTypeDependent()) {
if (!nameOwnerStillDependent && fieldOwner != null && !fieldOwner.isTypeDependent()) {
IType fieldOwnerType = fieldOwner.getType(context.getPoint());
if (fIsPointerDeref) {
fieldOwnerType = SemanticUtil.getSimplifiedType(fieldOwnerType);