Open
Description
Input C/C++ Header
template <class temp>
class MyClass {
public:
MyClass(){}
temp options;
static MyClass *first;
};
template <class temp> MyClass<temp> *MyClass<temp>::first = nullptr;
Bindgen Invocation
$ bindgen wrapper.hpp -- -x c++
Actual Results
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MyClass<temp> {
pub options: temp,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<temp>>,
}
extern "C" {
pub static mut first: *mut MyClass<temp>;
}
If you try to compile this, you get:
error[E0412]: cannot find type `temp` in this scope
--> src/main.rs:15:40
|
15 | pub static mut first: *mut MyClass<temp>;
| ^^^^ not found in this scope
Expected Results
No compile errors?
Mitigation
Removing
static MyClass *first;
and
template <class temp> MyClass<temp> *MyClass<temp>::first = nullptr;
and inserting
static MyClass *first = nullptr;
If I'm not wrong, it is equivalent.