Input C/C++ Header
static int take(struct { int x; int y; } s, int t) { return s.x + t; }
Bindgen Invocation
$ bindgen input.h --wrap-static-fns --wrap-static-fns-path wrap -- -x c -std=gnu11
Actual Results
bindgen exits 0. The generated wrapper is:
#include "input.h"
int take__extern(struct _bindgen_ty_1 s, int t) { return take(s, t); }
struct _bindgen_ty_1 is not in the header. clang:
wrap.c:5:25: warning: declaration of 'struct _bindgen_ty_1' will not be visible outside of this function
wrap.c:5:39: error: variable has incomplete type 'struct _bindgen_ty_1'
codegen/serialize.rs prints struct {canonical_name} for TypeKind::Comp. For an anonymous record that name is _bindgen_ty_N. A named struct S { int x; int y; } wrapper prints struct S and compiles.
Same thing for an anonymous union (union _bindgen_ty_1).
This is not #3403 (pointer-to-array declarators) or #2805 (_Bool vs bool).
Expected Results
The wrapper should use a C type that is complete after #include "input.h" (the original anonymous type, or a tag defined in the wrapper).
Environment
bindgen: 0.73.1 (rust-lang/rust-bindgen 77cbc723)
clang/libclang: Homebrew clang 21.1.8
rustc: 1.97.1
target: aarch64-apple-darwin
OS: macOS
Input C/C++ Header
Bindgen Invocation
$ bindgen input.h --wrap-static-fns --wrap-static-fns-path wrap -- -x c -std=gnu11Actual Results
bindgen exits 0. The generated wrapper is:
struct _bindgen_ty_1is not in the header. clang:codegen/serialize.rsprintsstruct {canonical_name}forTypeKind::Comp. For an anonymous record that name is_bindgen_ty_N. A namedstruct S { int x; int y; }wrapper printsstruct Sand compiles.Same thing for an anonymous union (
union _bindgen_ty_1).This is not #3403 (pointer-to-array declarators) or #2805 (
_Boolvsbool).Expected Results
The wrapper should use a C type that is complete after
#include "input.h"(the original anonymous type, or a tag defined in the wrapper).Environment