Open
Description
c++ header
template <typename> struct a { typedef int b; };
template <typename = a<int>> class c;
template <typename e> class c {
typedef typename e::b b;
c &d(long, b);
};
template <> c<> &c<>::d(long, b);
bindgen test-case-4.hpp -- -x c++
produces
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct a {
pub _address: u8,
}
pub type a_b = ::std::os::raw::c_int;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct c {
pub _address: u8,
}
pub type c_b = [u8; 0usize];
pub type b = b;
pub type b = ::std::os::raw::c_int;
`rustc --crate-type lib bindings.rs``` produces
error[E0428]: the name `b` is defined multiple times
--> bindings.rs:16:1
|
15 | pub type b = b;
| --------------- previous definition of the type `b` here
16 | pub type b = ::std::os::raw::c_int;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `b` redefined here
|
= note: `b` must be defined only once in the type namespace of this module
error[E0391]: cycle detected when computing type of `b`
--> bindings.rs:15:14
|
15 | pub type b = b;
| ^
|
= note: ...which again requires computing type of `b`, completing the cycle
note: cycle used when collecting item types in top-level module
--> bindings.rs:3:1
|
3 | / #[repr(C)]
4 | | #[derive(Debug, Copy, Clone)]
5 | | pub struct a {
6 | | pub _address: u8,
... |
15 | | pub type b = b;
16 | | pub type b = ::std::os::raw::c_int;
| |___________________________________^
This might be template specialization (my c++ is really poor) and so not expected to work. I wish bindgen would warn me that that was taking place instead of producing bindings that can't compile.