Skip to content

Error when binding template class with inline constructors definition #33

@farinaleo

Description

@farinaleo

Describe the issue

Hi,
I'm working on a school project and I got an error when I tried to bind a template class with constructors defined with inline. But I don't know why...

Warning: (SrcmlcppIgnoreElement) A cpp element of type "constructor" was stored as CppUnprocessed. Details follow
Warning: (SrcmlcppIgnoreElement) unhandled tag template
While parsing a "template", corresponding to this C++ code:
Position:14:1
    template<typename T>
    ^

Warning: (SrcmlcppIgnoreElement) A cpp element of type "constructor" was stored as CppUnprocessed. Details follow
Warning: (SrcmlcppIgnoreElement) unhandled tag template
While parsing a "template", corresponding to this C++ code:
Position:16:1
    template<typename T>
    ^

Version & Platform

Mention

  • the version of litgen you are using => 0.20.0
  • the type of bindings you are using: => pybind11

Minimal reproducible example

cpp_code  = """
template <typename T>
class Hello {
    public:
        Hello();
        Hello(T c);

        T getC(void) {return this->c;}
    private:
        T c;

};

template<typename T>
inline Hello<T>::Hello(): c(0) {};
template<typename T>
inline Hello<T>::Hello(T c): c(c) {};
"""

import litgen
from litgen.demo import litgen_demo

options = litgen.LitgenOptions()
options.class_template_options.add_specialization(r"^Hello$", ["int", "float", "double"])
generated_code = litgen.generate_code(options, cpp_code)

Is there any possibility to not bind inline definitions or make the code work?
I have a lot of code like this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions