That patch makes type check with pointer more strict.
Fixes bug 574486.
}
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;
}
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;