Skip to content

recursive without indirection #980

Open
@helloqirun

Description

@helloqirun

I am using this script https://gist.github.com/fitzgen/187381e358f60efa8194d0b276b4d11a.

The hashtag for my bindgen version is 4dd4ac7 .

$ ./b.sh rust-bindgen/target/debug/bindgen abc.h

clang-4.0: warning: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated [-Wdeprecated]
error[E0072]: recursive type `C` has infinite size
 --> /tmp/bindings-kGYvi3.rs:3:123
  |
3 | # [ repr ( C ) ] pub struct C__bindgen_vtable ( :: std :: os :: raw :: c_void ) ; # [ repr ( C ) ] # [ derive ( Debug ) ] pub struct C { pub vtable_ : * const C__bindgen_vtable , pub a : C , }
  |                                                                                                                           ^^^^^^^^^^^^ recursive type has infinite size            --------- recursive without indirection
  |
  = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `C` representable

error: aborting due to previous error

Interesting: bindgen emitted Rust code that won't compile!

$ cat abc.h

template < class T > struct C
{
  explicit C (const C & t):a (t)
  {
  } virtual ~ T ()
  {
  } C a;
};

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions