From 4d6c9dce1a1266d1552416c3ba669b4d067e1fcd Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Mon, 11 Jul 2016 14:11:26 -0700 Subject: [PATCH] Bug 497535 - Name resolution problem with template method Change-Id: I6bc4025f26d19dd0162f7e6c9d9cdad73c75e5d9 --- .../parser/tests/ast2/AST2TemplateTests.java | 44 +++++++++++++++++++ .../core/dom/parser/cpp/semantics/EvalID.java | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) 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 8e6a8d34bd4..7c437876bed 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 @@ -3702,6 +3702,50 @@ public class AST2TemplateTests extends AST2TestBase { assertInstance(mt1, ICPPFunctionTemplate.class); } + // template + // struct A { + // template + // static U m(); + // }; + // + // template ::template m())> + // class B {}; + // + // template + // void waldo(T p); + // + // template + // typename B::type waldo(T p); + // + // void test() { + // waldo(1); + // } + public void testMethodTemplate_497535a() throws Exception { + parseAndCheckBindings(); + } + + // template + // struct A { + // template + // static U m(); + // }; + // + // template ::template m())> + // class B {}; + // + // template + // void waldo(T p); + // + // template + // typename B::type waldo(T p); + // + // void test() { + // waldo(1); + // } + public void testMethodTemplate_497535b() throws Exception { + parseAndCheckBindings(); + } + // template class XT {}; // template class XT {public: int partial;}; // void test() { 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 5c7fe24a13f..3f5b508668e 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 @@ -422,7 +422,7 @@ public class EvalID extends CPPDependentEvaluation { } catch (DOMException e) { } IBinding[] bindings = data.getFoundBindings(); - if (bindings.length > 1 && bindings[0] instanceof ICPPFunction) { + if (bindings.length >= 1 && bindings[0] instanceof ICPPFunction) { ICPPFunction[] functions = new ICPPFunction[bindings.length]; System.arraycopy(bindings, 0, functions, 0, bindings.length); return new EvalFunctionSet(new CPPFunctionSet(functions, templateArgs, null), fQualified, fAddressOf,