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

const fails when used as the argument to a template of a template #1355

Closed
robertwb opened this issue Jan 30, 2013 · 3 comments · Fixed by #3886
Closed

const fails when used as the argument to a template of a template #1355

robertwb opened this issue Jan 30, 2013 · 3 comments · Fixed by #3886

Comments

@robertwb
Copy link
Contributor

This works:

from libcpp.vector cimport vector

cdef extern from "Test.hpp":
    cdef vector[char](const) f()

As does this:

from libcpp.vector cimport vector

cdef extern from "Test.hpp":
    cdef vector[f()

But this causes a Cython parse error on Cython 0.18:

from libcpp.vector cimport vector

cdef extern from "Test.hpp":
    cdef vector[vector[const char](vector[char]])] f()

Migrated from http://trac.cython.org/ticket/798

@robertwb
Copy link
Contributor Author

garrison changed cc to garrison
commented

@scoder
Copy link
Contributor

scoder commented Oct 23, 2020

The obvious work-around is a ctypedef, but it seems worth fixing.

The parser calls p_buffer_or_template() to parse the […] part, which then calls p_positional_and_keyword_args() to parse what's inside of the brackets. I guess that simply doesn't allow template type declarations. It could, though. That would probably also help with template type parsing in function signatures.

Also needs a test, probably in one of the tests/run/cpp_*.pyx modules.

@scoder scoder added the Parsing label Oct 23, 2020
@shwina
Copy link
Contributor

shwina commented Oct 23, 2020

Taking a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants