Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2017-01-24 00:47:57 -0500
committerNathan Ridge2017-02-09 15:02:52 -0500
commit0eb29c397df19ed6894031cb9f472cbecd67107e (patch)
tree15b9bdbfcb2a94d96c45f430ecbc5762dfc8e92f
parent810257caee3494f596600cd3ebf869d874b5f0c5 (diff)
downloadorg.eclipse.cdt-0eb29c397df19ed6894031cb9f472cbecd67107e.tar.gz
org.eclipse.cdt-0eb29c397df19ed6894031cb9f472cbecd67107e.tar.xz
org.eclipse.cdt-0eb29c397df19ed6894031cb9f472cbecd67107e.zip
Bug 510834 - Propagate substitute failure in EvalID.instantiate() with field owner
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java35
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java2
2 files changed, 37 insertions, 0 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 7a4a3518a3..28174ce7a7 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
@@ -9884,4 +9884,39 @@ public class AST2TemplateTests extends AST2TestBase {
// Just check that resolution does not throw an exception.
helper.findName("waldo", 5).resolveBinding();
}
+
+ // template <typename Ty>
+ // struct has_rbegin_impl {
+ // typedef char yes[1];
+ // typedef char no[2];
+ // template <typename Inner>
+ // static yes& test(Inner *I, decltype(I->rbegin()) * = nullptr);
+ // template <typename >
+ // static no& test(...);
+ // static const bool value = sizeof(test<Ty>(nullptr)) == sizeof(yes);
+ // };
+ //
+ // template <bool, typename _Tp = void>
+ // struct enable_if {};
+ //
+ // template <typename _Tp>
+ // struct enable_if<true, _Tp> {
+ // typedef _Tp type;
+ // };
+ //
+ // template <typename Container>
+ // void reverse(Container&& C, typename enable_if<has_rbegin_impl<Container>::value>::type * = nullptr);
+ //
+ // template <typename Container>
+ // void reverse(Container&& C, typename enable_if<!has_rbegin_impl<Container>::value>::type * = nullptr);
+ //
+ // class MyContainer{};
+ //
+ // int main() {
+ // MyContainer c;
+ // reverse(c); // Ambiguous
+ // }
+ public void testWaldo_510834() 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 9827261bbe..7b8620ee92 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
@@ -394,6 +394,8 @@ public class EvalID extends CPPDependentEvaluation {
ICPPEvaluation eval = resolveName((ICPPClassType) fieldOwnerClassType, fieldOwner, templateArgs, fieldOwnerClassTypeCV, context.getPoint());
if (eval != null)
return eval;
+ if (!CPPTemplates.isDependentType(fieldOwnerClassType))
+ return EvalFixed.INCOMPLETE;
}
}

Back to the top