Bug 480892 - Compare bindings by value equality during final overrider
authorNathan Ridge <zeratul976@hotmail.com>
Fri, 27 Nov 2015 06:01:15 +0000 (01:01 -0500)
committerSergey Prigogin <eclipse.sprigogin@gmail.com>
Thu, 24 Dec 2015 02:23:20 +0000 (18:23 -0800)
analysis

Change-Id: I6a530710bdd5ea029726f8ed42e8a3c11f39996b
Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPInheritance.java

index 649db4a..9aa09ef 100644 (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>
index 8ca076c..e1e7373 100644 (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;
                                }