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
namespace example {
template<typename Real>
class Vector{
public:
Vector() { }
void Set(int i, Real r){
//Sets i-th element equal to r
}
};
template<class ObjectType>
class ObjectTypeHolder {
public:
typedef ObjectType T;
ObjectTypeHolder() { }
void FailTerribly(ObjectTypeHolder<T> *other){
// Fails...
}
void DoNothing(ObjectTypeHolder<T> &other){
//Does not fail...
}
};
}
We wrap it in vector.clif
from "vector.h":
namespace `example`:
class `Vector<float>` as Vector:
def Set(self, i:int, r:float)
class `ObjectTypeHolder< Vector<float> >` as VectorHolder:
def DoNothing(self, other:VectorHolder)
def FailTerribly(self, other:VectorHolder)
Which raises the following issue when doing python setup.py install
vector-clifwrap.cc: In function ‘PyObject* vector_clifwrap::pyVectorHolder::wrapFailTerribly(PyObject*, PyObject*, PyObject*)’:
vector-clifwrap.cc:218:60: error: ‘Vector’ was not declared in this scope
::example::ObjectTypeHolder< ::example::ObjectTypeHolder<Vector<float> >::T> * arg1;
^
vector-clifwrap.cc:218:60: note: suggested alternative:
In file included from vector-clifwrap.h:9:0,
from vector-clifwrap.cc:11:
vector.h:9:8: note: ‘example::Vector’
class Vector{
^
vector-clifwrap.cc:218:72: error: template argument 1 is invalid
::example::ObjectTypeHolder< ::example::ObjectTypeHolder<Vector<float> >::T> * arg1;
^
vector-clifwrap.cc:218:74: error: template argument 1 is invalid
::example::ObjectTypeHolder< ::example::ObjectTypeHolder<Vector<float> >::T> * arg1;
^
vector-clifwrap.cc:218:78: error: expected initializer before ‘>’ token
::example::ObjectTypeHolder< ::example::ObjectTypeHolder<Vector<float> >::T> * arg1;
^
vector-clifwrap.cc:219:28: error: ‘arg1’ was not declared in this scope
if (!Clif_PyObjAs(a[0], &arg1)) return ArgError("FailTerribly", names[0], "::example::ObjectTypeHolder< ::example::ObjectTypeHolder<
^
vector-clifwrap.cc:226:21: error: ‘arg1’ was not declared in this scope
c->FailTerribly(arg1);
^
error: command 'gcc' failed with exit status 1
As you may see, this error does not happen for DoNothing and it goes away if we do not expose FailTerribly in the clif file. For comparison, here are the important parts from the produced code in both methods:
Thank you for the report. The bug was identified (in LLVM API) and we are working to alleviate it in CLIF. ETA fix is the next release coming this quarter.
There is no good workaround on the user side but if you can avoid typedefs in FailTerribly it might help.
Consider the file
vector.h
We wrap it in
vector.clif
Which raises the following issue when doing
python setup.py install
As you may see, this error does not happen for
DoNothing
and it goes away if we do not exposeFailTerribly
in the clif file. For comparison, here are the important parts from the produced code in both methods:DoNothing
FailTerribly
What would be the general advice to wrap such cases?
The text was updated successfully, but these errors were encountered: