[bug #59775] "error: mark_as_constructed: invalid object" when constructor returns classdef array
Thomas <[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 #9, bug #59775 (group octave):
Quick fix: I've attached the same patch but following the 80-char limit in the
hg commit message.
Marc (with a c): Apologies, I meant to offer credit to "Mark Goldberg" for
using his test cases almost verbatim in my patch. Normally, credit isn't given
for submitting a bug report, only for copyright-able code being used (not
merely a suggestion). However, I appreciate the report very much, and I hope a
fix is still useful after so many years.
Mark (with a k): I'm glad to hear that you're working on cross-compatible
software. I will be happy to help with any classdef incompatibilities you
report, as that's my personal project of interest.
Regarding your newfound bug: it is actually because function call subsref
syntax doesn't work with classdef arrays. To be explicit about what I mean:
>> m = mre4([1, 2, 3]);
>> a = [m.A];
>> b = a/mean(a);
>> p = mre4(b);
>> p(1)
ans =
1x1 mre4 object with properties:
A: 0.5000
>> p(2)
ans =
1x1 mre4 object with properties:
A: 1
>> p(3)
ans =
1x1 mre4 object with properties:
A: 1.5000
>> p2 = norm(m) %ok
p2 =
1x1 mre object with properties:
A: [0.5000, 1, 1.5000]
It is because the built-in `subsref` method does not handle calling a function
on a classdef array. Bug #47755 is actually the same issue, though it doesn't
look like it at first glance. So we can continue the discussion there. I am
working on fixing it, although it is a bit more involved of a fix than this
patch was.
(file #58318)
_______________________________________________________
Additional Item Attachment:
Name: bug59775_v2.patch Size: 3.4KiB
<https://file.savannah.gnu.org/file/bug59775_v2.patch?file_id=58318>
AGPL NOTICE
These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://savannah.gnu.org/source/savane-5479f0ac3e1f014845fd281c379bc3ccb7a72723.tar.gz
_______________________________________________________
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----- iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCaayubQAKCRCqLAuaBUf3 Th/HAQDU+ZK3oQTsgKST+LveKQcwbcYi91sDObwkcYXc5rAMUwEAlxPLzjkc+1Ax pR/FmlSoJPbHJB5dTbRHobDp7s3xTw0= =dHlk -----END PGP SIGNATURE-----