You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
namespaceroot {
namespacens1 {
structA{};
}
namespacens2 {
using ns1::A;
// using A = ns1::A; swtich to this line generates the correct resultstructB{
voidf(const A& a);
};
}
}
Bindgen Invocation
bindgen gen.h -- -xc++
Actual Results
/* automatically generated by rust-bindgen 0.71.1 */#[repr(C)]#[derive(Debug,Copy,Clone)]pubstructroot_ns1_A{pub_address:u8,}#[allow(clippy::unnecessary_operation, clippy::identity_op)]const _:() = {["Size of root_ns1_A"][::std::mem::size_of::<root_ns1_A>() - 1usize];["Alignment of root_ns1_A"][::std::mem::align_of::<root_ns1_A>() - 1usize];};#[repr(C)]#[derive(Debug,Copy,Clone)]pubstructroot_ns2_B{pub_address:u8,}#[allow(clippy::unnecessary_operation, clippy::identity_op)]const _:() = {["Size of root_ns2_B"][::std::mem::size_of::<root_ns2_B>() - 1usize];["Alignment of root_ns2_B"][::std::mem::align_of::<root_ns2_B>() - 1usize];};unsafeextern"C"{#[link_name = "\u{1}_ZN4root3ns21B1fERKNS_3ns11AE"]pubfnroot_ns2_B_f(this:*mutroot_ns2_B,a:*mutroot_ns1_A);}implroot_ns2_B{#[inline]pubunsafefnf(&mutself,a:*mutroot_ns1_A){root_ns2_B_f(self, a)}}
note that if i replace using ns1::A with using A = ns1::A, it will produce correct result
The text was updated successfully, but these errors were encountered:
lulitao1997
changed the title
bindgen generates *mut instead of *const from C++ header, when the parameter type is from another namespace
bindgen incorrectly generates *mut instead of *const from C++ header, when the parameter type is from another namespace
Dec 22, 2024
Input C/C++ Header
Bindgen Invocation
Actual Results
Expected Results
should be
instead of
note that if i replace
using ns1::A
withusing A = ns1::A
, it will produce correct resultThe text was updated successfully, but these errors were encountered: