[bug #59775] "error: mark_as_constructed: invalid object" when constructor returns classdef array

Mark Goldberg <[email protected]>
Newsgroups gmane.comp.gnu.octave.bugs
Message-ID <[email protected]>
Please use the bug tracker to post updates to a bug report.  The mailing list is intended as a read-only notification stream.  Info posted to this mailing list address won't appear in the tracker database where it is most useful.

Follow-up Comment #4, bug #59775 (group octave):

Adding two examples to recreate the issue.

classdef mre2
    properties
        A
    end
    methods
        function obj = mre2(a)
            if nargin > 0
                if isscalar(a)
                    obj.A = a;
                else
                    obj(size(a)) = mre2();
                    c = num2cell(a);
                    [obj.A] = c{:};
                end
            end
        end
    end
end


octave:40> m = mre2([1,2,3]);
error: mark_as_constructed: invalid object
octave:41> 


classdef mre3
    properties
        A
    end
    methods
        function obj = mre3(a)
            if nargin > 0
                if isscalar(a)
                    obj.A = a;
                else
                    obj(size(a)) = mre3();
                    for kk = 1:numel(a)
                        obj(kk).A = a(kk);
                    end
                end
            end
        end
    end
end


octave:41> m = mre3([1,2,3]);
error: mark_as_constructed: invalid object
octave:42> 




    _______________________________________________________

Reply to this item at:

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

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCaal66gAKCRCqLAuaBUf3
TkW9AP9IqNqfJ7yIvjlsxliDC+V5SAMP1A0NykDdWnOcTG9SZgD/clSosrEhlYDh
CQ+7+T0+A6amepnx2og16sTga4DJ9Ak=
=FNsf
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.