1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-14 20:45:22 +02:00

Bug 480892 - Compare bindings by value equality during final overrider

analysis

Change-Id: I6a530710bdd5ea029726f8ed42e8a3c11f39996b
Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
This commit is contained in:
Nathan Ridge 2015-11-27 01:01:15 -05:00 committed by Sergey Prigogin
parent 927dd7502d
commit e9800bd4a1
2 changed files with 21 additions and 1 deletions

View file

@ -55,6 +55,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
import org.eclipse.cdt.core.dom.ast.cpp.SemanticQueries;
import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.index.IIndexBinding;
import org.eclipse.cdt.core.index.IndexFilter;
@ -609,6 +610,25 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
public void testInstanceInheritance_258745() throws Exception {
getBindingFromFirstIdentifier("a", ICPPField.class);
}
// template <typename>
// struct Base {
// virtual void foo() = 0;
// };
//
// struct Derived : Base<int> {
// virtual void foo();
// };
// Derived waldo;
public void testMethodOveriddenFromTemplateInstanceBase_480892() throws Exception {
IVariable waldo = getBindingFromFirstIdentifier("waldo");
IType derived = waldo.getType();
assertInstance(derived, ICPPClassType.class);
ICPPClassType derivedClass = (ICPPClassType) derived;
ICPPMethod[] pureVirtualMethods = SemanticQueries.getPureVirtualMethods(derivedClass, null);
assertEquals(0, pureVirtualMethods.length);
}
// class A {}; class B {}; class C {};
// template<typename T1, typename T2>

View file

@ -252,7 +252,7 @@ public class CPPInheritance {
for (ICPPMethod method : ClassTypeHelper.getOwnMethods(classType, point)) {
// Skip methods that don't actually belong to us, such as methods brought
// into scope via a using-declaration.
if (method.getOwner() != classType) {
if (!method.getOwner().equals(classType)) {
continue;
}