You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
there are two issues here:
1 is not a priority which is the GetSmartPtrInfo interface which is missing but when we create converters for normal C++ classes it returns false anyway so most tests/usecases it will still work.
the second is the interesting bug. The converter creation for args relies on a loop over args that sets up the dispatch cache.
where we do fullType = GetMethodArgType(fMethod, iarg)
The cling implementation does
TFunction* f = m2f(method);
TMethodArg* arg = (TMethodArg*)f->GetListOfMethodArgs()->At((int)iarg);
std::string ft = arg->GetFullTypeName();
which will always return the C++ type of the arg with which we call the function.
But with clang this returns theParmVarDeclwhich for a templated parameter is ‘A’ in the case of
template<class A>
long get_size(A) {
return sizeof(A)+1;
}
And we cannot create a converter passing a string type 'A'
I did think of one way to approach this. We look for the Clang::DeclStmt that should be created when the python side cppyy.obj.function(arg) is called.
Then we traverse the AST which should contain the CXXMemberCallExpr for the MemberExpr which is our bound member function get_size and the nodes would contain the types of the literals passed.
We get the normalised type and go from there. This should even work for multiple template parameters:
template<class A, class B>
long get_size(A, B) {
return sizeof(A)+sizeof(B);
}|
long res = a.get_size(1.5, 'A');
Fails the vectorcall from TemplateProxies when calling the corresponding Executor (in CPyCppyy/Executors.cxx).
Reproducible example:
there are two issues here:
1 is not a priority which is the
GetSmartPtrInfo
interface which is missing but when we create converters for normal C++ classes it returns false anyway so most tests/usecases it will still work.the second is the interesting bug. The converter creation for args relies on a loop over args that sets up the dispatch cache.
where we do
fullType = GetMethodArgType(fMethod, iarg)
The cling implementation does
which will always return the C++ type of the arg with which we call the function.
For example if we do
it will be
but with m.get_size('A')
But with clang this returns the
ParmVarDecl
which for a templated parameter is ‘A’ in the case ofAnd we cannot create a converter passing a string type 'A'
I did think of one way to approach this. We look for the
Clang::DeclStmt
that should be created when the python sidecppyy.obj.function(arg)
is called.Then we traverse the AST which should contain the
CXXMemberCallExpr
for theMemberExpr
which is our bound member function get_size and the nodes would contain the types of the literals passed.We get the normalised type and go from there. This should even work for multiple template parameters:
CallExpr
node will contain:The text was updated successfully, but these errors were encountered: