Open
Description
C++ header
template <class a> struct b : a { typename b::c d; };
bindgen command
bindgen test-case-3.hpp -- -x c++
Produced bindings
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct b<a> {
pub _base: a,
pub d: b<a>,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<a>>,
}
rustc --crate-type lib bindings.rs
produces
error[E0072]: recursive type `b` has infinite size
--> bindings.rs:5:1
|
5 | pub struct b<a> {
| ^^^^^^^^^^^^^^^ recursive type has infinite size
6 | pub _base: a,
7 | pub d: b<a>,
| ---- recursive without indirection
|
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `b` representable
|
7 | pub d: Box<b<a>>,
| ^^^^ ^
error[E0391]: cycle detected when computing drop-check constraints for `b`
--> bindings.rs:5:1
|
5 | pub struct b<a> {