From 01d2201caa7c0ebcd4b03dc0301d543eab19b96e Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Fri, 26 Dec 2008 06:32:06 +0000 Subject: [PATCH] Additional fix for bug 259680. --- .../core/parser/tests/ast2/AST2CPPTests.java | 19 ++++++++++++------- .../dom/parser/cpp/semantics/CPPVisitor.java | 3 +++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java index ec85b013984..6722930bd23 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java @@ -6135,12 +6135,12 @@ public class AST2CPPTests extends AST2BaseTest { ba.assertProblem("a; // should not resolve", 1); } } - + // namespace ns { // template class CT {}; // } // using ns::CT; - public void testTemplateIDInUsingDecl_251199() throws Exception { + public void testTemplateIdInUsingDecl_251199() throws Exception { parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP); } @@ -6157,7 +6157,7 @@ public class AST2CPPTests extends AST2BaseTest { bh.assertNonProblem("operator ns::A", 14); parseAndCheckBindings(code, ParserLanguage.CPP); } - + // void f(); // // void test(int p) { @@ -6315,15 +6315,20 @@ public class AST2CPPTests extends AST2BaseTest { } // struct A { - // int operator*() { return 0; } + // int& operator*(); + // const int& operator*() const; // }; - // void func(int p) {} + // void func(int& p) {} + // void func(const int& p) {} // - // void test(A& a) { + // void test(A& a, const A& b) { // func(*a); + // func(*b); // } public void testSmartPointerReference_259680() throws Exception { BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); - ba.assertNonProblem("func(*a)", 4, ICPPFunction.class); + ICPPFunction f1= ba.assertNonProblem("func(*a)", 4, ICPPFunction.class); + ICPPFunction f2= ba.assertNonProblem("func(*b)", 4, ICPPFunction.class); + assertNotSame(f1, f2); } } 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 deff53f5ea2..4802a64be6b 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 @@ -1954,6 +1954,9 @@ public class CPPVisitor extends ASTQueries { if (type instanceof ICPPReferenceType) { type = ((ICPPReferenceType) type).getType(); } + if (type instanceof IQualifierType) { + type = ((IQualifierType) type).getType(); + } if (type instanceof ICPPClassType) { ICPPFunction operator= CPPSemantics.findOperator(expression, (ICPPClassType) type); if (operator != null) {