Browse Source

oops, invalid downcasts

David Rose 24 years ago
parent
commit
756d334463
1 changed files with 4 additions and 1 deletions
  1. 4 1
      dtool/src/interrogate/interfaceMaker.cxx

+ 4 - 1
dtool/src/interrogate/interfaceMaker.cxx

@@ -581,7 +581,10 @@ record_object(TypeIndex type_index) {
       record_function(itype, itype.derivation_get_upcast(di));
       record_function(itype, itype.derivation_get_upcast(di));
     }
     }
     if (itype.derivation_has_downcast(di)) {
     if (itype.derivation_has_downcast(di)) {
-      record_function(itype, itype.derivation_get_downcast(di));
+      // Downcasts are methods of the base class, not the child class.
+      TypeIndex base_type_index = itype.get_derivation(di);
+      const InterrogateType &base_type = idb->get_type(base_type_index);
+      record_function(base_type, itype.derivation_get_downcast(di));
     }
     }
   }
   }