From a82ad3fe728c41b9cd7c519963cdd1f21a65f2ca Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrg=20Billeter?= Date: Tue, 22 Sep 2009 18:32:04 +0200 Subject: [PATCH] Fix virtual methods returning structs Fixes bug 595954. --- codegen/valagtypemodule.vala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala index 1eb3d745..2f3634de 100644 --- a/codegen/valagtypemodule.vala +++ b/codegen/valagtypemodule.vala @@ -327,13 +327,19 @@ internal class Vala.GTypeModule : GErrorModule { return; } + var creturn_type = m.return_type; + if (m.return_type.is_real_non_null_struct_type ()) { + // structs are returned via out parameter + creturn_type = new VoidType (); + } + // add vfunc field to the type struct var vdeclarator = new CCodeFunctionDeclarator (m.vfunc_name); var cparam_map = new HashMap (direct_hash, direct_equal); generate_cparameters (m, decl_space, cparam_map, new CCodeFunction ("fake"), vdeclarator); - var vdecl = new CCodeDeclaration (m.return_type.get_cname ()); + var vdecl = new CCodeDeclaration (creturn_type.get_cname ()); vdecl.add_declarator (vdeclarator); type_struct.add_declaration (vdecl); } -- 2.11.4.GIT