-
Notifications
You must be signed in to change notification settings - Fork 162
Open
Description
Describe the bug
generate_pod! fails for types that contain function pointers due to:
its dependent type std::option::Option isn't known
To Reproduce
Here's the simplest header I was able to come up with to reproduce:
struct my_struct {
void (*f)(void);
};
Expected behavior
A structure with a function pointer is trivially relocatable and in my understanding should be a POD, similarly to how bindgen treats it:
pub struct my_struct {
f: Option<unsafe extern "C" fn()>,
}
Additional context
The error message gets even weirder for a more complex example:
typedef void (*f_t)(void);
struct my_struct {
f_t f;
};
output:
[INFO autocxx_engine::conversion] ##### APIs after parsing:
StringConstructor { name: autocxx_make_string_0xead583f54cb8a785 }
Struct { name: my_struct (cpp=my_struct), details: StructDetails { item: # [repr (C)] pub struct my_struct { pub f : root :: f_t , }, has_rvalue_reference_fields: false }, analysis: () }
Typedef { name: f_t (cpp=f_t), item: Type(pub type f_t = :: std :: option :: Option < unsafe extern "C" fn () > ;), old_tyname: None, analysis: () }
[INFO autocxx_engine::conversion] ##### APIs after typedefs:
IgnoredItem { name: f_t (cpp=f_t), err: UnsupportedBuiltInType(std::option::Option), ctx: Some(ErrorContext(Item(f_t), PhantomSanitized)) }
StringConstructor { name: autocxx_make_string_0xead583f54cb8a785 }
Struct { name: my_struct (cpp=my_struct), details: StructDetails { item: # [repr (C)] pub struct my_struct { pub f : root :: f_t , }, has_rvalue_reference_fields: false }, analysis: () }
called `Result::unwrap()` on an `Err` value: AutoCxx(ParseError(AutocxxCodegenError(Conversion(Cpp(UnsafePodType("Type my_struct could not be POD because its dependent type f_t isn't known"))))))
Metadata
Metadata
Assignees
Labels
No labels