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

Bug 413406 - [false negative] Ambiguous base class lookup

Change-Id: I9f81619eb40456529fbfe4ce42ced661b9f1dac2
Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
Reviewed-on: https://git.eclipse.org/r/14728
Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
Nathan Ridge 2013-07-21 21:40:00 -04:00 committed by Sergey Prigogin
parent d8549d514c
commit 3d97b3e93c
2 changed files with 38 additions and 0 deletions

View file

@ -2364,4 +2364,23 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
public void testNPE_407497() throws Exception {
checkBindings();
}
// template <typename>
// struct basic_A {
// bool eof() const;
// };
//
// typedef basic_A<char> A;
// class B : public A {};
//
// class C : public A, public B {};
//
// void foo() {
// C c;
// c.eof();
// }
public void testAmbiguousBaseClassLookup_413406() throws Exception {
getProblemFromASTName("eof();", 3);
}
}

View file

@ -275,4 +275,23 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
public EScopeKind getKind() {
return EScopeKind.eClassType;
}
// Note: equals() and hashCode() are overridden because multiple instances
// of this class representing the same class specialization scope
// may be created, but scopes are sometimes stored in hash maps
// under the assumption that two objects representing the same
// scope will compare equal().
@Override
public boolean equals(Object other) {
if (other instanceof ICPPClassSpecializationScope) {
return getClassType().equals(((ICPPClassSpecializationScope) other).getClassType());
}
return false;
}
@Override
public int hashCode() {
return specialClass.hashCode();
}
}