Skip to content

C++ features we can't handle right now. #41

Closed as not planned
Closed as not planned
@emilio

Description

@emilio

This is a list of things we can't handle correctly in bindgen, and we're not expected to be able to in a while.

Partial template specialization

We can't get the specialized types from a construct like this via libclang, rather unfortunately. We do hackily search through the ast to get the non-specialized ones though.

template<typename T, typename U>
class Foo { };

template<typename T>
class Bar {
  Foo<T, int> mFoo;
};

In the above example the ast for Bar is the following:

(ClassTemplate Bar Invalid
    (TemplateTypeParameter T Unexposed
    )
    (FieldDecl mFoo Unexposed
        (TemplateRef Foo Invalid
        )
        (TypeRef T Unexposed
        )
    )
)

And type template parameter related functions in bindgen don't give us any information.

Template unions with template parameters inside.

We can't handle this because the size of the union depends on size_of::<T>, and that's not const fn (and we can't use const fn in stable anyway). We can try to compute it and be correct if T is not the largest type in the union.

template<typename T>
union Bar {
  T mFoo;
  int mBar;
};

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions