[bug #68108] classdef objects do not support creation of initialized arrays

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 #8, bug #68108 (group octave):

I too built your patch and verified that it fixes the MRE in comment #0.
However I've found that such initialized classdef object arrays fail to be
returned by the classdef constructor as in the following scenarios. Please
advise if this is different enough to justify a separate bug report.


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/?68108>

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

iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCaag8PgAKCRCqLAuaBUf3
ThspAP0ff+tT0IqM5PdiRRQ/7LwWHHP93mLAjB1sdP0XZkm3xwD/ZVoUWQAOpIet
aocUwwJ9/1DlGStcbj+WwXmtemo9qQ4=
=wDhM
-----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.