Hello,
I am appending Python dict objects to a C++ vector of structs. If it
is done implicitly (calling v.push_back(dict_object)), Cython creates
C++ code that does not compile. If dict_object has been cdef'd to be
of the struct type, everything works. I am using version cf75e9eb7e
from the master branch.
Here is the code for reproducing the problem
# cythonbug.pyx
from libcpp.vector cimport vector
ctypedef struct test_struct:
int a
int b
def main():
cdef vector[test_struct] test_vector
# cdef test_struct dict_object # Uncommenting this avoids the bug
dict_object = {"a": 0, "b": 1}
test_vector.push_back(dict_object)
# end cythonbug.pyx
The C++ output from "cython --cplus cythonbug.pyx" contains the
statement "__pyx_t_9cythonbug_test_struct;" which GCC complains about:
"error: declaration does not declare anything [-fpermissive]".
Best wishes,
Joonas Paalasmaa
_______________________________________________
cython-devel mailing list
[email protected]
https://mail.python.org/mailman/listinfo/cython-devel