Fixed const-ness of multidimensional arrays

This commit is contained in:
Joseph Angelo 2020-08-03 17:08:46 -07:00 committed by Emilio Cobos Álvarez
parent 7f7809f779
commit 87b2bc033f
3 changed files with 15 additions and 1 deletions

View File

@ -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()?

View File

@ -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]);
}

View File

@ -0,0 +1 @@
void f(const int a[1][1]);