summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ir/ty.rs5
-rw-r--r--tests/expectations/tests/const_multidim_array_fn_arg.rs10
-rw-r--r--tests/headers/const_multidim_array_fn_arg.h1
3 files changed, 15 insertions, 1 deletions
diff --git a/src/ir/ty.rs b/src/ir/ty.rs
index c1560ac3..e6eecc3c 100644
--- a/src/ir/ty.rs
+++ b/src/ir/ty.rs
@@ -1209,7 +1209,10 @@ impl Type {
let name = if name.is_empty() { None } else { Some(name) };
- let is_const = ty.is_const();
+ let is_const = ty.is_const() ||
+ (ty.kind() == CXType_ConstantArray &&
+ ty.elem_type()
+ .map_or(false, |element| element.is_const()));
let ty = Type::new(name, layout, kind, is_const);
// TODO: maybe declaration.canonical()?
diff --git a/tests/expectations/tests/const_multidim_array_fn_arg.rs b/tests/expectations/tests/const_multidim_array_fn_arg.rs
new file mode 100644
index 00000000..11ae184d
--- /dev/null
+++ b/tests/expectations/tests/const_multidim_array_fn_arg.rs
@@ -0,0 +1,10 @@
+#![allow(
+ dead_code,
+ non_snake_case,
+ non_camel_case_types,
+ non_upper_case_globals
+)]
+
+extern "C" {
+ pub fn f(a: *const [::std::os::raw::c_int; 1usize]);
+}
diff --git a/tests/headers/const_multidim_array_fn_arg.h b/tests/headers/const_multidim_array_fn_arg.h
new file mode 100644
index 00000000..784a51fe
--- /dev/null
+++ b/tests/headers/const_multidim_array_fn_arg.h
@@ -0,0 +1 @@
+void f(const int a[1][1]);