bugGNU Octave - Bugs: bug #51285, max_recursion_depth error in...

 
 

bug #51285: max_recursion_depth error in classdef constructor

Submitter:  Guillaume <gyom>
Submitted:  Wed 21 Jun 2017 09:55:57 AM UTC
   
 
Category:  Classdef Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Wont Fix Assigned to:  None
Originator Name:  Guillaume Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 30 Jan 2024 10:17:21 PM UTC, comment #1: 

The test code when run with the development code for Octave 10.1, produces an error about constructing the classdef object, rather than a max_recursion_depth error.


error: mark_as_constructed: invalid object


I think this is fine.  The constructor for a classdef object must return one object, not an object array.  It's true that "obj(1)" and "obj" should be the same thing, but enabling the parser to handle this special case doesn't seem worth it given how trivial the workaround is.

Marking as Won't Fix and closing report.

Rik <rik5>
Group administrator
Wed 21 Jun 2017 09:55:57 AM UTC, original submission:  

Out of curiosity, I was testing further @gramm and came across an infinite recursion at the highlighted lines:
https://github.com/piermorel/gramm/blob/master/%40gramm/gramm.m#L180
https://github.com/piermorel/gramm/blob/master/%40gramm/set_names.m#L29

To reproduce it, use the following class:


classdef recurse
  properties
    value = [];
  endproperties
  methods
    function obj = recurse ()
      obj(1).value.prop = 42;
    endfunction
  endmethods
endclassdef


Calling the constructor returns:


octave:1> recurse
error: max_recursion_depth exceeded
error: called from
    recurse at line 7 column 25


This disappears if obj.value is used instead of obj(1).value.

Guillaume <gyom>

 

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

Attach Files:
   
   
Comment:
   

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 rik5 (Posted a comment)
  • -email is unavailable- added by mmuetzel (Updated the item)
  • -email is unavailable- added by gyom (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-01-30 rik5 StatusNone Wont Fix
        Open/ClosedOpen Closed
    2024-01-23 mmuetzel CategoryInterpreter Classdef

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code