Unexposed enums in struct fields lead to generation of bindings with Void as field's type.
As struct's fields cannot have the Void type, the generated binding is broken.
To reproduce:
$ cat <<'EOF' > /tmp/bug.h
struct st {
int a;
enum { x, y } b;
};
struct st *test();
EOF
$ crystal src/main.cr <<'EOF'
@[Include("/tmp/bug.h", prefix: %w(test))]
lib LibTest
end
EOF
lib LibTest
fun = test : St*
struct St
a : LibC::Int
b : Void
end
end
When trying to use the binding, the following error is thrown at compile time: can't use Void as a struct field type
.