mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 489477 - Compare AST types to PDOM types correctly during final overrider analysis
Change-Id: Ie34dad36cfb9f459b997a859c2c193745131f5c8
This commit is contained in:
parent
f136f05560
commit
1723662de3
2 changed files with 23 additions and 1 deletions
|
@ -45,6 +45,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
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.IIndex;
|
||||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||||
import org.eclipse.cdt.core.parser.IProblem;
|
import org.eclipse.cdt.core.parser.IProblem;
|
||||||
|
@ -2278,4 +2279,24 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
||||||
ICPPVariable v= getBindingFromFirstIdentifier("test");
|
ICPPVariable v= getBindingFromFirstIdentifier("test");
|
||||||
assertTrue(v.getType() instanceof IProblemType);
|
assertTrue(v.getType() instanceof IProblemType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// struct A {
|
||||||
|
// virtual bool foo() = 0;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// struct B : A {
|
||||||
|
// bool foo();
|
||||||
|
// };
|
||||||
|
|
||||||
|
// class B;
|
||||||
|
// int main() {
|
||||||
|
// B waldo;
|
||||||
|
// }
|
||||||
|
public void testFinalOverriderAnalysis_489477() throws Exception {
|
||||||
|
ICPPVariable waldo = getBindingFromFirstIdentifier("waldo");
|
||||||
|
IType type = waldo.getType();
|
||||||
|
assertInstance(type, ICPPClassType.class);
|
||||||
|
ICPPMethod[] pureVirtuals = SemanticQueries.getPureVirtualMethods((ICPPClassType) type, null);
|
||||||
|
assertEquals(0, pureVirtuals.length);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,7 +252,8 @@ public class CPPInheritance {
|
||||||
for (ICPPMethod method : ClassTypeHelper.getOwnMethods(classType, point)) {
|
for (ICPPMethod method : ClassTypeHelper.getOwnMethods(classType, point)) {
|
||||||
// Skip methods that don't actually belong to us, such as methods brought
|
// Skip methods that don't actually belong to us, such as methods brought
|
||||||
// into scope via a using-declaration.
|
// into scope via a using-declaration.
|
||||||
if (!method.getOwner().equals(classType)) {
|
if (!(method.getOwner() instanceof ICPPClassType &&
|
||||||
|
((ICPPClassType) method.getOwner()).isSameType(classType))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue