Open
Description
Input C/C++ Header
template <typename T>
class Test {
enum class Enum { One, Two };
};
Bindgen Invocation
Tested both with the current release and current main
:
$ bindgen input.h -- -x c++ -std=c++11
Actual Results
/* automatically generated by rust-bindgen 0.69.4 */
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Test {
pub _address: u8,
}
pub const Test_Enum_One: Test_Enum = 0;
pub const Test_Enum_Two: Test_Enum = 0;
pub type Test_Enum = ::std::os::raw::c_int;
Expected Results
I would expect to see the same enum generated as for a non-templated class. Removing the first line of input.h
results in this generated code:
/* automatically generated by rust-bindgen 0.69.4 */
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Test {
pub _address: u8,
}
pub const Test_Enum_One: Test_Enum = 0;
pub const Test_Enum_Two: Test_Enum = 1;
pub type Test_Enum = ::std::os::raw::c_int;
#[test]
fn bindgen_test_layout_Test() {
assert_eq!(
::std::mem::size_of::<Test>(),
1usize,
concat!("Size of: ", stringify!(Test))
);
assert_eq!(
::std::mem::align_of::<Test>(),
1usize,
concat!("Alignment of ", stringify!(Test))
);
}