From d96ec1dfc888365e61f5b02671d6b0fbb50650b5 Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Sat, 14 Dec 2013 01:52:03 -0500 Subject: [PATCH] Bug 422505 - Additional fix for unqualified case Change-Id: Ia2a154c789d1b46643a67958611589e900ae0f18 Signed-off-by: Nathan Ridge Reviewed-on: https://git.eclipse.org/r/19826 Tested-by: Hudson CI Reviewed-by: Sergey Prigogin IP-Clean: Sergey Prigogin Tested-by: Sergey Prigogin --- .../parser/tests/ast2/AST2TemplateTests.java | 18 +++++++++++++++++- .../dom/parser/cpp/semantics/CPPVisitor.java | 3 ++- 2 files changed, 19 insertions(+), 2 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 a8a937771f0..1859e3cfdfe 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 @@ -76,6 +76,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPDeferredFunction; import org.eclipse.cdt.core.dom.ast.cpp.ICPPField; import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate; @@ -8177,7 +8178,22 @@ public class AST2TemplateTests extends AST2TestBase { // class A { // friend int ns::waldo(const A&); // }; - public void testDependentSpecializationOfFunctionTemplateAsFriend_422505() throws Exception { + public void testDependentSpecializationOfFunctionTemplateAsFriend_422505a() throws Exception { parseAndCheckBindings(); } + + // template + // class A; + // + // template + // int waldo(const A&); + // + // template + // class A { + // friend int waldo(const A&); + // }; + public void testDependentSpecializationOfFunctionTemplateAsFriend_422505b() throws Exception { + BindingAssertionHelper helper = getAssertionHelper(); + helper.assertNonProblem("waldo", ICPPDeferredFunction.class); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java index de15420e56b..ff07f68b304 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java @@ -146,6 +146,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPDeferredFunction; import org.eclipse.cdt.core.dom.ast.cpp.ICPPEnumeration; import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionScope; @@ -849,7 +850,7 @@ public class CPPVisitor extends ASTQueries { if (isFunction) { if (binding instanceof ICPPInternalBinding && binding instanceof ICPPFunction && name.isActive()) { ICPPFunction function = (ICPPFunction) binding; - boolean sameFunction = CPPSemantics.isSameFunction(function, typeRelevantDtor); + boolean sameFunction = CPPSemantics.isSameFunction(function, typeRelevantDtor) || function instanceof ICPPDeferredFunction; if (function.getOwner() instanceof ICPPClassType) { // Don't consider a function brought into scope from a base class scope // to be the same as a function declared in a derived class scope.