Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2017-01-26 22:14:00 -0500
committerNathan Ridge2017-02-09 17:35:13 -0500
commitbbbf9c7059d703307d33a6fb23312da4f8c07cb5 (patch)
tree563dcf22cf6ca544c338ebe69c53aa3670815689
parent0eb29c397df19ed6894031cb9f472cbecd67107e (diff)
downloadorg.eclipse.cdt-bbbf9c7059d703307d33a6fb23312da4f8c07cb5.tar.gz
org.eclipse.cdt-bbbf9c7059d703307d33a6fb23312da4f8c07cb5.tar.xz
org.eclipse.cdt-bbbf9c7059d703307d33a6fb23312da4f8c07cb5.zip
Bug 511108 - Do not attempt to resolve the name in an EvalID if the name owner is still dependent
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java38
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java8
2 files changed, 43 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
index 28174ce7a7..b07c15764e 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
@@ -9916,7 +9916,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();
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java
index 7b8620ee92..36c5bf8274 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java
@@ -370,15 +370,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);

Back to the top