octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #63841] nargout is always 0 or 1 for subsref()


From: A.R. Burgers
Subject: [Octave-bug-tracker] [bug #63841] nargout is always 0 or 1 for subsref() in classdef methods
Date: Mon, 27 Feb 2023 09:32:26 -0500 (EST)

Follow-up Comment #8, bug #63841 (project octave):

for () indexing also octave-9 gets it right, but not for {} and .

class tst_nargout:


classdef tst_nargout
  methods
    function varargout = subsref(obj, s)
      fprintf('nargout=%d, s(1).type = %s\n', nargout, s(1).type);
    end
  end
end


exercising tst_nargout:


ti = tst_nargout;

fprintf('2 outputs requested\n');
try; [a, b] = ti.call_a_method; catch; end
try; [a, b] = ti{1};            catch; end
try; [a, b] = ti(1);            catch; end

fprintf('3 outputs requested\n');
try; [a, b, c] = ti.call_a_method; catch; end
try; [a, b, c] = ti{1};            catch; end
try; [a, b, c] = ti(1);            catch; end


octave-8 output


2 outputs requested
nargout=2, s(1).type = .
nargout=2, s(1).type = {}
nargout=2, s(1).type = ()
3 outputs requested
nargout=3, s(1).type = .
nargout=3, s(1).type = {}
nargout=3, s(1).type = ()


octave-9 output


2 outputs requested
nargout=1, s(1).type = .
nargout=1, s(1).type = {}
nargout=2, s(1).type = ()
3 outputs requested
nargout=1, s(1).type = .
nargout=1, s(1).type = {}
nargout=3, s(1).type = ()



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63841>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]