summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ir/ty.rs11
-rw-r--r--tests/expectations/tests/class.rs2
-rw-r--r--tests/expectations/tests/var-tracing.rs2
-rw-r--r--tests/headers/class.hpp2
4 files changed, 14 insertions, 3 deletions
diff --git a/src/ir/ty.rs b/src/ir/ty.rs
index 1e87beb4..96a6e6a2 100644
--- a/src/ir/ty.rs
+++ b/src/ir/ty.rs
@@ -816,8 +816,7 @@ impl Type {
}
// XXX DependentSizedArray is wrong
CXType_VariableArray |
- CXType_DependentSizedArray |
- CXType_IncompleteArray => {
+ CXType_DependentSizedArray => {
let inner = Item::from_ty(ty.elem_type().as_ref().unwrap(),
location,
parent_id,
@@ -825,6 +824,14 @@ impl Type {
.expect("Not able to resolve array element?");
TypeKind::Pointer(inner)
}
+ CXType_IncompleteArray => {
+ let inner = Item::from_ty(ty.elem_type().as_ref().unwrap(),
+ location,
+ parent_id,
+ ctx)
+ .expect("Not able to resolve array element?");
+ TypeKind::Array(inner, 0)
+ }
CXType_FunctionNoProto |
CXType_FunctionProto => {
let signature = try!(FunctionSig::from_ty(ty,
diff --git a/tests/expectations/tests/class.rs b/tests/expectations/tests/class.rs
index 579c24a4..951b259a 100644
--- a/tests/expectations/tests/class.rs
+++ b/tests/expectations/tests/class.rs
@@ -32,6 +32,8 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
pub struct C {
pub a: ::std::os::raw::c_int,
pub big_array: [::std::os::raw::c_char; 33usize],
+ pub zero_length_array: [::std::os::raw::c_char; 0usize],
+ pub incomplete_array: [::std::os::raw::c_char; 0usize],
}
#[test]
fn bindgen_test_layout_C() {
diff --git a/tests/expectations/tests/var-tracing.rs b/tests/expectations/tests/var-tracing.rs
index 75c5ebe3..ef5660eb 100644
--- a/tests/expectations/tests/var-tracing.rs
+++ b/tests/expectations/tests/var-tracing.rs
@@ -36,7 +36,7 @@ pub struct Baz {
}
extern "C" {
#[link_name = "_ZN3Baz3FOOE"]
- pub static mut Baz_FOO: *const Bar;
+ pub static mut Baz_FOO: [Bar; 0usize];
}
#[test]
fn bindgen_test_layout_Baz() {
diff --git a/tests/headers/class.hpp b/tests/headers/class.hpp
index e753f186..402f8b2b 100644
--- a/tests/headers/class.hpp
+++ b/tests/headers/class.hpp
@@ -2,6 +2,8 @@ class C {
int a;
// More than rust limits (32)
char big_array[33];
+ char zero_length_array[0];
+ char incomplete_array[];
};
class WithDtor {