changeset 15958:4aedc32e3f4d classdef

Check constructor access. * libinterp/octave-value/ov-classdef.cc (cdef_class::cdef_class_rep::run_constructor): Check constructor method access.
author Michael Goffioul <michael.goffioul@gmail.com>
date Tue, 15 Jan 2013 20:53:04 -0500
parents db6371b97fed
children de240df20290
files libinterp/octave-value/ov-classdef.cc
diffstat 1 files changed, 18 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-classdef.cc	Tue Jan 15 19:52:18 2013 -0500
+++ b/libinterp/octave-value/ov-classdef.cc	Tue Jan 15 20:53:04 2013 -0500
@@ -2099,23 +2099,28 @@
 
   if (ctor.ok ())
     {
-      octave_value_list ctor_args (args);
-      octave_value_list ctor_retval;
-
-      ctor_args.prepend (to_ov (obj));
-      ctor_retval = ctor.execute (ctor_args, 1);
-
-      if (! error_state)
+      if (ctor.check_access ())
         {
-          if (ctor_retval.length () == 1)
-            obj = to_cdef (ctor_retval(0));
-          else
+          octave_value_list ctor_args (args);
+          octave_value_list ctor_retval;
+
+          ctor_args.prepend (to_ov (obj));
+          ctor_retval = ctor.execute (ctor_args, 1);
+
+          if (! error_state)
             {
-              ::error ("%s: invalid number of output arguments for classdef constructor",
-                       ctor_name.c_str ());
-              return;
+              if (ctor_retval.length () == 1)
+                obj = to_cdef (ctor_retval(0));
+              else
+                {
+                  ::error ("%s: invalid number of output arguments for classdef constructor",
+                           ctor_name.c_str ());
+                  return;
+                }
             }
         }
+      else
+        gripe_method_access ("constructor", ctor);
     }
 
   obj.mark_as_constructed (wrap ());