diff libinterp/octave-value/cdef-object.cc @ 27056:64461ccf3039

allow inherited method calls during classdef construction (bug #52614) * cdef-object.cc (cdef_object_scalar::is_partially_constructed_for): When iterating over ctor_list, call is_partially_constructed_for instead of is_constructed_for. * test/classdef/class_bug52614A.m, test/classdef/class_bug52614B.m: New files. * test/classdef/module.mk: Update. * test/classdef/classdef.tst: New test.
author John W. Eaton <jwe@octave.org>
date Fri, 19 Apr 2019 12:38:13 +0000
parents 342fc514de46
children 6b0c61a5a0f0
line wrap: on
line diff
--- a/libinterp/octave-value/cdef-object.cc	Fri Apr 19 13:30:51 2019 +0200
+++ b/libinterp/octave-value/cdef-object.cc	Fri Apr 19 12:38:13 2019 +0000
@@ -724,16 +724,17 @@
   bool
   cdef_object_scalar::is_partially_constructed_for (const cdef_class& cls) const
   {
-    std::map< cdef_class, std::list<cdef_class>>::const_iterator it;
-
     if (is_constructed ())
       return true;
-    else if ((it = ctor_list.find (cls)) == ctor_list.end ()
-             || it->second.empty ())
+
+    std::map<cdef_class, std::list<cdef_class>>::const_iterator it
+      = ctor_list.find (cls);
+
+    if (it == ctor_list.end () || it->second.empty ())
       return true;
 
     for (const auto& cdef_cls : it->second)
-      if (! is_constructed_for (cdef_cls))
+      if (! is_partially_constructed_for (cdef_cls))
         return false;
 
     return true;