From: Rico Tzschichholz Date: Fri, 26 Jul 2019 12:03:12 +0000 (+0200) Subject: codegen: Include required type-definition when casting from generic pointer X-Git-Tag: 0.45.90~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=768f7a28de01f9521e1f160899256517a65c5ba5;p=thirdparty%2Fvala.git codegen: Include required type-definition when casting from generic pointer Fixes https://gitlab.gnome.org/GNOME/vala/issues/828 --- diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index 783aa06e8..1e2b4b38e 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -5874,6 +5874,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { public CCodeExpression convert_from_generic_pointer (CCodeExpression cexpr, DataType actual_type) { var result = cexpr; if (is_reference_type_argument (actual_type) || is_nullable_value_type_argument (actual_type)) { + generate_type_declaration (actual_type, cfile); result = new CCodeCastExpression (cexpr, get_ccode_name (actual_type)); } else if (is_signed_integer_type_argument (actual_type)) { result = new CCodeCastExpression (new CCodeCastExpression (cexpr, "gintptr"), get_ccode_name (actual_type));