summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbindgen/src/codegen/mod.rs2
-rw-r--r--libbindgen/tests/expectations/tests/typedefd-array-as-function-arg.rs10
-rw-r--r--libbindgen/tests/headers/typedefd-array-as-function-arg.h3
3 files changed, 14 insertions, 1 deletions
diff --git a/libbindgen/src/codegen/mod.rs b/libbindgen/src/codegen/mod.rs
index 8b4993a8..ae59bc52 100644
--- a/libbindgen/src/codegen/mod.rs
+++ b/libbindgen/src/codegen/mod.rs
@@ -1945,7 +1945,7 @@ impl ToRustTy for FunctionSig {
// the array type derivation.
//
// [1]: http://c0x.coding-guidelines.com/6.7.5.3.html
- let arg_ty = if let TypeKind::Array(t, _) = *arg_ty.kind() {
+ let arg_ty = if let TypeKind::Array(t, _) = *arg_ty.canonical_type(ctx).kind() {
t.to_rust_ty(ctx).to_ptr(arg_ty.is_const(), ctx.span())
} else {
arg_item.to_rust_ty(ctx)
diff --git a/libbindgen/tests/expectations/tests/typedefd-array-as-function-arg.rs b/libbindgen/tests/expectations/tests/typedefd-array-as-function-arg.rs
new file mode 100644
index 00000000..56074f75
--- /dev/null
+++ b/libbindgen/tests/expectations/tests/typedefd-array-as-function-arg.rs
@@ -0,0 +1,10 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+pub type myVector3 = [f32; 3usize];
+extern "C" {
+ pub fn modifyVectorFunc(v: *mut f32);
+}
diff --git a/libbindgen/tests/headers/typedefd-array-as-function-arg.h b/libbindgen/tests/headers/typedefd-array-as-function-arg.h
new file mode 100644
index 00000000..93790591
--- /dev/null
+++ b/libbindgen/tests/headers/typedefd-array-as-function-arg.h
@@ -0,0 +1,3 @@
+// foo.h
+typedef float myVector3[3];
+void modifyVectorFunc(myVector3 v);