]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix virtual methods returning structs
authorJürg Billeter <j@bitron.ch>
Tue, 22 Sep 2009 16:32:04 +0000 (18:32 +0200)
committerJürg Billeter <j@bitron.ch>
Tue, 22 Sep 2009 16:32:04 +0000 (18:32 +0200)
Fixes bug 595954.

codegen/valagtypemodule.vala

index 1eb3d745d97c343f017db698887811b65cf97ff3..2f3634de3bbc8b0d1081536a28a11b77ceb54a1b 100644 (file)
@@ -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<int,CCodeFormalParameter> (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);
        }