summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vala/valapointertype.vala17
-rw-r--r--vapi/glib-2.0.vapi2
2 files changed, 17 insertions, 2 deletions
diff --git a/vala/valapointertype.vala b/vala/valapointertype.vala
index 76922dcc9..d3203f461 100644
--- a/vala/valapointertype.vala
+++ b/vala/valapointertype.vala
@@ -62,7 +62,22 @@ public class Vala.PointerType : DataType {
}
public override bool compatible (DataType target_type) {
- if (target_type is PointerType || (target_type.data_type != null && target_type.data_type.get_attribute ("PointerType") != null)) {
+ if (target_type is PointerType) {
+ var tt = target_type as PointerType;
+
+ if (tt.base_type is VoidType || base_type is VoidType) {
+ return true;
+ }
+
+ /* dereference only if both types are references or not */
+ if (base_type.is_reference_type_or_type_parameter () != tt.base_type.is_reference_type_or_type_parameter ()) {
+ return false;
+ }
+
+ return base_type.compatible (tt.base_type);
+ }
+
+ if ((target_type.data_type != null && target_type.data_type.get_attribute ("PointerType") != null)) {
return true;
}
diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi
index f4e1b61a0..b877a4a0e 100644
--- a/vapi/glib-2.0.vapi
+++ b/vapi/glib-2.0.vapi
@@ -1007,7 +1007,7 @@ public class string {
string* result = GLib.malloc0 (this.size () - ((char*) end_string - (char*) start_string) + str_size + 1);
- char* dest = result;
+ char* dest = (char*) result;
GLib.Memory.copy (dest, this, (char*) start_string - (char*) this);
dest += (char*) start_string - (char*) this;