bugGNU Octave - Bugs: bug #55856, subsref called in a subscripted...


bug #55856: subsref called in a subscripted assignment operation

Submitted by:  Guillaume <gyom>
Submitted on:  Thu 07 Mar 2019 05:40:37 PM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  None Assigned to:  None
Originator Name:  Guillaume Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Thu 07 Mar 2019 05:40:37 PM UTC, original submission:  

Define the following class with subsref and subsasgn methods

%%% @foo/foo.m
function obj = foo ()
  obj = struct ("store", []);
  obj = class(obj, 'foo');

%%% @foo/subsref.m
function val = subsref (obj, S)
  disp ("subsref");
  val = builtin ("subsref", obj.store, S);

%%% @foo/subsasgn.m
function obj = subsasgn (obj, S, val)
  disp ("subsasgn");
  obj.store = builtin ("subsasgn", obj.store, S, val);

In Matlab:

>> f = foo ();
>> f.a.b = 1;
>> f.a.b
ans =

In Octave 5.1 or 6.0:

octave:1> f = foo ();
octave:2> f.a.b = 1;
error: null_matrix cannot be indexed with .
error: called from
    subsref at line 3 column 7
octave:2> f.a = 1;

I don't think that subsref should be called when evaluating "f.a.b = 1;"

Guillaume <gyom>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by gyom (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    No changes have been made to this item

    Back to the top

    Powered by Savane 3.5