]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Always set value_owned to false for pointers
authorLuca Bruno <lucabru@src.gnome.org>
Wed, 25 May 2011 09:44:33 +0000 (11:44 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Wed, 25 May 2011 19:02:37 +0000 (21:02 +0200)
Fixes bug 650993.

tests/Makefile.am
tests/basic-types/bug650993.vala [new file with mode: 0644]
vala/valaparser.vala

index 013585efe236c9a02955762fa439309c006ad981..422571e0d408e71a48eb6c1510f7765dd0dc5252 100644 (file)
@@ -25,6 +25,7 @@ TESTS = \
        basic-types/bug596637.vala \
        basic-types/bug596785.vala \
        basic-types/bug632322.vala \
+       basic-types/bug650993.vala \
        namespaces.vala \
        methods/lambda.vala \
        methods/closures.vala \
diff --git a/tests/basic-types/bug650993.vala b/tests/basic-types/bug650993.vala
new file mode 100644 (file)
index 0000000..db47e9d
--- /dev/null
@@ -0,0 +1,7 @@
+void *test () {
+       return null;
+}
+
+void main () {
+       unowned int[] o = (int[]) test();
+}
index 991b0088790353735496d8fbefbfd01d2c3d927f..ad97da8790b0a39abd5995cff287b4c20100f69c 100644 (file)
@@ -489,6 +489,10 @@ public class Vala.Parser : CodeVisitor {
                        }
                }
 
+               if (type is PointerType) {
+                       value_owned = false;
+               }
+
                type.is_dynamic = is_dynamic;
                type.value_owned = value_owned;
                return type;