Skip to content

Commit 63b7f06

Browse files
fix dispatcher for rvalue
requires test, used in cross-inheritance
1 parent ba04ee9 commit 63b7f06

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/Cppyy.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,10 @@ namespace Cppyy {
335335
CPPYY_IMPORT
336336
std::string GetTypeAsString(TCppType_t type);
337337
CPPYY_IMPORT
338+
bool IsRValueReferenceType(TCppType_t type);
339+
CPPYY_IMPORT
340+
bool IsLValueReferenceType(TCppType_t type);
341+
CPPYY_IMPORT
338342
bool IsClassType(TCppType_t type);
339343
CPPYY_IMPORT
340344
bool IsFunctionPointerType(TCppType_t type);

src/Dispatcher.cxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,10 @@ bool CPyCppyy::InsertDispatcher(CPPScope* klass, PyObject* bases, PyObject* dct,
320320
code << "{\n return " << binfo.bname << "::" << mtCppName << "(";
321321
for (Cppyy::TCppIndex_t i = 0; i < nArgs; ++i) {
322322
if (i != 0) code << ", ";
323-
code << "arg" << i;
323+
if (Cppyy::IsRValueReferenceType(Cppyy::GetMethodArgType(method, i)))
324+
code << "std::move(arg" << i << ")";
325+
else
326+
code << "arg" << i;
324327
}
325328
code << ");\n }\n";
326329
}

0 commit comments

Comments
 (0)