From: Rico Tzschichholz Date: Sat, 1 Feb 2020 15:29:59 +0000 (+0100) Subject: codegen: Explicitly include header for length-type of arrays X-Git-Tag: 0.47.4~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fffba4519f94cf3a01b574390f8a748767b9094c;p=thirdparty%2Fvala.git codegen: Explicitly include header for length-type of arrays --- diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index 31ac415d9..ee1c4fbb1 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -1553,6 +1553,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { } else if (type is ArrayType) { var array_type = (ArrayType) type; generate_type_declaration (array_type.element_type, decl_space); + if (array_type.length_type != null) { + generate_type_declaration (array_type.length_type, decl_space); + } } else if (type is ErrorType) { var error_type = (ErrorType) type; if (error_type.error_domain != null) { diff --git a/tests/Makefile.am b/tests/Makefile.am index 14e855071..7166e74e0 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -83,6 +83,7 @@ TESTS = \ arrays/inline-parameter.test \ arrays/inline-struct-field.test \ arrays/length-inline-assignment.vala \ + arrays/length-type-include.vala \ arrays/struct-field-length-cname.vala \ arrays/incompatible-integer-elements.test \ arrays/slice-invalid-start.test \ diff --git a/tests/arrays/length-type-include.vala b/tests/arrays/length-type-include.vala new file mode 100644 index 000000000..63e2ad2dd --- /dev/null +++ b/tests/arrays/length-type-include.vala @@ -0,0 +1,3 @@ +void main () { + unowned void*[] foo = null; +}