octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #65667] classdef calls overloaded function str


From: Rik
Subject: [Octave-bug-tracker] [bug #65667] classdef calls overloaded function struct() rather than builtin struct()
Date: Sat, 4 May 2024 10:54:30 -0400 (EDT)

Update of bug #65667 (group octave):

                  Status:                    None => Confirmed              
                 Summary: inputParser does not accept object with struct
method as default value => classdef calls overloaded function struct() rather
than builtin struct()

    _______________________________________________________

Follow-up Comment #1:

It helps to surround code examples in a bug report with the verbatim tag so
they are rendered in a fixed-width font.

The issue seems to be that testClass overloads the "struct" function with its
own definition and when


struct ("p", c)


is called it is the overloaded version of the function from testClass which
expects only one input which is called.

That is probably a bug, but it would be useful if someone could test this
under Matlab.  I've re-titled the bug report and marked it as Confirmed.

For the time being, there are lots of workarounds and you should use one of
those.

Workaround #1: dot notation


s.p = c;


Workaround #2: use builtin() to call base function rather than overload


s = builtin ('struct', 'p', c);


Workaround #3: use a function which isn't overloaded.


s = struct ();
s = setfield ('p', c);





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65667>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]