Skip to content

Usage of unexposed enums leads to generation of broken bindings #66

@olbat

Description

@olbat

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions