]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix C code generated for local string array constants
authorJürg Billeter <j@bitron.ch>
Tue, 21 May 2013 04:52:02 +0000 (06:52 +0200)
committerJürg Billeter <j@bitron.ch>
Tue, 21 May 2013 04:52:02 +0000 (06:52 +0200)
Fixes bug 646970.

vala/valaparser.vala

index 9f090f3ed92b187263e92a6c43044a6f30016e05..9ee008bf9f0550481021b8b2b33c40791c9e762b 100644 (file)
@@ -1,6 +1,6 @@
 /* valaparser.vala
  *
- * Copyright (C) 2006-2011  Jürg Billeter
+ * Copyright (C) 2006-2013  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -1751,6 +1751,13 @@ public class Vala.Parser : CodeVisitor {
        void parse_local_constant_declarations (Block block) throws ParseError {
                expect (TokenType.CONST);
                var constant_type = parse_type (false, false);
+
+               // constant arrays don't own their element
+               var array_type = constant_type as ArrayType;
+               if (array_type != null) {
+                       array_type.element_type.value_owned = false;
+               }
+
                do {
                        DataType type_copy = constant_type.copy ();
                        var local = parse_local_constant (type_copy);