1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Additional fix for bug 259680.

This commit is contained in:
Sergey Prigogin 2008-12-26 06:32:06 +00:00
parent f707b944ef
commit 01d2201caa
2 changed files with 15 additions and 7 deletions

View file

@ -6135,12 +6135,12 @@ public class AST2CPPTests extends AST2BaseTest {
ba.assertProblem("a; // should not resolve", 1); ba.assertProblem("a; // should not resolve", 1);
} }
} }
// namespace ns { // namespace ns {
// template<typename T> class CT {}; // template<typename T> class CT {};
// } // }
// using ns::CT<int>; // using ns::CT<int>;
public void testTemplateIDInUsingDecl_251199() throws Exception { public void testTemplateIdInUsingDecl_251199() throws Exception {
parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP); parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP);
} }
@ -6157,7 +6157,7 @@ public class AST2CPPTests extends AST2BaseTest {
bh.assertNonProblem("operator ns::A", 14); bh.assertNonProblem("operator ns::A", 14);
parseAndCheckBindings(code, ParserLanguage.CPP); parseAndCheckBindings(code, ParserLanguage.CPP);
} }
// void f(); // void f();
// //
// void test(int p) { // void test(int p) {
@ -6315,15 +6315,20 @@ public class AST2CPPTests extends AST2BaseTest {
} }
// struct A { // 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(*a);
// func(*b);
// } // }
public void testSmartPointerReference_259680() throws Exception { public void testSmartPointerReference_259680() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); 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);
} }
} }

View file

@ -1954,6 +1954,9 @@ public class CPPVisitor extends ASTQueries {
if (type instanceof ICPPReferenceType) { if (type instanceof ICPPReferenceType) {
type = ((ICPPReferenceType) type).getType(); type = ((ICPPReferenceType) type).getType();
} }
if (type instanceof IQualifierType) {
type = ((IQualifierType) type).getType();
}
if (type instanceof ICPPClassType) { if (type instanceof ICPPClassType) {
ICPPFunction operator= CPPSemantics.findOperator(expression, (ICPPClassType) type); ICPPFunction operator= CPPSemantics.findOperator(expression, (ICPPClassType) type);
if (operator != null) { if (operator != null) {