jaeandersson / swig

SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages.
http://www.swig.org
Other
23 stars 19 forks source link

Octave subsref warnings: warning: 'uint64 matrix' object indexed with empty index list #99

Open KrisThielemans opened 2 years ago

KrisThielemans commented 2 years ago

96 reinstated the subsref functions in Swigref.m. However, when running the test-suite with recent Octave, it generates lots of warnings like

warning: 'uint64 matrix' object indexed with empty index list
 warning: called from
  subsref at line 29 column 28

an example is generated at https://github.com/jaeandersson/swig/blob/cd3f6c5fe9ed273fcc981dcae3e8b50d51529664/Examples/test-suite/matlab/default_args_runme.m#L18 This turns out to come from the following line in SwigRef.m (generated here)

[varargout{1}] = builtin('subsref',self,substruct('.',s.subs,'()',{}));

It is caused by the empty cell-array for (). The warning can be reproduced as follows

a.x=1;
subsref(a,substruct('.','x','()',{}))

This does returns 1 but with the same warning (but is silent in MATLAB).

The simple solution seems to use

[varargout{1}] = builtin('subsref',self,substruct('.',s.subs));

which has the desired effect