]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix local variable initialization of basic types
authorJürg Billeter <j@bitron.ch>
Mon, 20 Apr 2009 14:30:16 +0000 (16:30 +0200)
committerJürg Billeter <j@bitron.ch>
Mon, 20 Apr 2009 14:44:13 +0000 (16:44 +0200)
gobject/valaccodebasemodule.vala

index 6ba6e1799d39c106c859eae3c10d32b5645f1ce1..625a8aa4c962c9764942c03d70abecfdd096a817 100644 (file)
@@ -3722,9 +3722,11 @@ internal class Vala.CCodeBaseModule : CCodeModule {
        }
 
        public CCodeExpression? default_value_for_type (DataType type, bool initializer_expression) {
+               var st = type.data_type as Struct;
                var array_type = type as ArrayType;
-               if (initializer_expression && (type.data_type is Struct ||
-                   (array_type != null && array_type.fixed_length))) {
+               if (initializer_expression &&
+                   ((st != null && !st.is_simple_type ()) ||
+                    (array_type != null && array_type.fixed_length))) {
                        // 0-initialize struct with struct initializer { 0 }
                        // only allowed as initializer expression in C
                        var clist = new CCodeInitializerList ();