summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2013-12-14 01:52:03 (EST)
committerSergey Prigogin2013-12-16 00:43:19 (EST)
commitd96ec1dfc888365e61f5b02671d6b0fbb50650b5 (patch)
tree272aa8b712d4dd023eee16c9019cf1bde3d0c3b9
parent7f3095be514c9055f906b74e045810cca226cc46 (diff)
downloadorg.eclipse.cdt-d96ec1dfc888365e61f5b02671d6b0fbb50650b5.zip
org.eclipse.cdt-d96ec1dfc888365e61f5b02671d6b0fbb50650b5.tar.gz
org.eclipse.cdt-d96ec1dfc888365e61f5b02671d6b0fbb50650b5.tar.bz2
Bug 422505 - Additional fix for unqualified caserefs/changes/26/19826/2
Change-Id: Ia2a154c789d1b46643a67958611589e900ae0f18 Signed-off-by: Nathan Ridge <zeratul976@hotmail.com> Reviewed-on: https://git.eclipse.org/r/19826 Tested-by: Hudson CI Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java18
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java3
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 a8a9377..1859e3c 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<T>(const A<T>&);
// };
- public void testDependentSpecializationOfFunctionTemplateAsFriend_422505() throws Exception {
+ public void testDependentSpecializationOfFunctionTemplateAsFriend_422505a() throws Exception {
parseAndCheckBindings();
}
+
+ // template <typename T>
+ // class A;
+ //
+ // template <typename T>
+ // int waldo(const A<T>&);
+ //
+ // template <typename T>
+ // class A {
+ // friend int waldo<T>(const A<T>&);
+ // };
+ public void testDependentSpecializationOfFunctionTemplateAsFriend_422505b() throws Exception {
+ BindingAssertionHelper helper = getAssertionHelper();
+ helper.assertNonProblem("waldo<T>", 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 de15420..ff07f68 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.