Skip to content

calling void functions without arguments now needs () #38

@KrisThielemans

Description

@KrisThielemans

we have a C++ member function wrapped that takes no arguments. One of our users used to be able to call this in matlab without brackets, but this now throws an error:
One or more output arguments not assigned during call to "voidvoidtest_wrap".
It does work with brackets though. It seems that in the recent update to subsref this behaviour changed.
Note that it still works without brackets for stand-alone functions or static member functions.

To reproduce this:

%module testit
%{
#include <stdio.h>
%}

%inline %{
void testfunction() { printf("OK\n"); };

class testclass
{
public:
static void statictestfunction() { printf("OK\n"); };
testclass() {}
// this is the one with the problem
void membertestfunction() { printf("OK\n"); };
};
%}

With the above interface file, I get in matlab

a=testit.testclass;
a.membertestfunction()
OK
a.membertestfunction
OK
One or more output arguments not assigned during call to "voidvoidtest_wrap".

Error in testit.testclass/testfunction (line 13)
[varargout{1:nargout}] = voidvoidtest_wrap(6, self, varargin{:});

Error in SwigRef/subsref (line 13)
[varargout{1}] = builtin('subsref',self,substruct('.',s.subs,'()',{}));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions