2008-04-07 Jürg Billeter <j@bitron.ch>
+ * vala/valasymbolresolver.vala: reset takes_ownership and
+ transfers_ownership for base types of pointer types
+
+ * tests/pointers.vala: test element access for methods returning
+ pointers
+
+2008-04-07 Jürg Billeter <j@bitron.ch>
+
* vala/valasemanticanalyzer.vala: don't compare base_method and
base_interface_method in visit_class as this might not be set yet
in other classes; available methods will already be checked in
delete st;
test_pointers_element_access ();
+ test_pointers_return_value ();
}
static void test_pointers_element_access () {
assert (array[0] == 23);
delete array;
}
+
+ const int[] array = { 42 };
+
+ static int* return_pointer () {
+ return array;
+ }
+
+ static void test_pointers_return_value () {
+ int i = return_pointer ()[0];
+ assert (i == 42);
+ }
}
}
for (int pointer_level = unresolved_type.pointer_level; pointer_level > 0; pointer_level--) {
- type = new PointerType (type);
+ var base_type = type;
+ base_type.takes_ownership = false;
+ base_type.transfers_ownership = false;
+ base_type.is_ref = false;
+ base_type.is_out = false;
+
+ type = new PointerType (base_type);
}
if (!type.is_reference_type_or_type_parameter ()) {