Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Templated constructors #3198

Open
mje-nz opened this issue Oct 20, 2019 · 0 comments

Comments

@mje-nz
Copy link
Contributor

@mje-nz mje-nz commented Oct 20, 2019

This was reported on the mailing list a few years ago but I can't see an issue for it.

cdef extern from "<any>" namespace "std" nogil: 
    cdef cppclass any: 
        any() 
        any(const any& other) except + 
        any[ValueType](ValueType value) except + 
 
cdef any a 
Error compiling Cython file:
------------------------------------------------------------
...
cdef extern from "<any>" namespace "std" nogil:
    cdef cppclass any:
        any()
        any(const any& other) except +
        any[ValueType](ValueType value) except +
                    ^
------------------------------------------------------------

test.pyx:5:21: undeclared name not builtin: ValueType

Error compiling Cython file:
------------------------------------------------------------
...
cdef extern from "<any>" namespace "std" nogil:
    cdef cppclass any:
        any()
        any(const any& other) except +
        any[ValueType](ValueType value) except +
                    ^
------------------------------------------------------------

test.pyx:5:21: Array dimension not integer

Error compiling Cython file:
------------------------------------------------------------
...
cdef extern from "<any>" namespace "std" nogil:
    cdef cppclass any:
        any()
        any(const any& other) except +
        any[ValueType](ValueType value) except +
                      ^
------------------------------------------------------------

test.pyx:5:23: 'ValueType' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
cdef extern from "<any>" namespace "std" nogil:
    cdef cppclass any:
        any()
        any(const any& other) except +
        any[ValueType](ValueType value) except +
                     ^
------------------------------------------------------------

test.pyx:5:22: Missing name in declaration.

Yury's workaround works:

cdef extern from "<any>" namespace "std" nogil: 
    cdef cppclass any: 
        any() 
        any(const any& other) except + 
        any any[ValueType](ValueType value) except + 
 
cdef any a 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.