push_function (function);
var dest_struct = new GLibValue (get_data_type_for_symbol (st), new CCodeIdentifier ("(*dest)"), true);
- foreach (var f in st.get_fields ()) {
+ unowned Struct sym = st;
+ while (sym.base_struct != null) {
+ sym = sym.base_struct;
+ }
+ foreach (var f in sym.get_fields ()) {
if (f.binding == MemberBinding.INSTANCE) {
var value = load_field (f, load_this_parameter ((TypeSymbol) st));
if ((!(f.variable_type is DelegateType) || get_ccode_delegate_target (f)) && requires_copy (f.variable_type)) {
enums/bug763831.vala \
enums/bug780050.vala \
structs/struct_only.vala \
+ structs/struct-base-types.vala \
structs/struct-empty-still.test \
structs/struct-no-gtype.vala \
structs/struct-static-field-initializer.vala \
--- /dev/null
+struct Foo {
+ public string s;
+}
+
+struct Bar : Foo {
+}
+
+void main () {
+ {
+ Bar bar = { "bar" };
+ Foo foo = bar;
+
+ assert (bar.s == "bar");
+ assert (bar.s == foo.s);
+
+ void* s1 = foo.s;
+ void* s2 = bar.s;
+ assert (s1 != s2);
+ }
+ {
+ Foo foo = { "foo" };
+ Bar bar = foo;
+
+ assert (foo.s == "foo");
+ assert (foo.s == bar.s);
+
+ void* s1 = foo.s;
+ void* s2 = bar.s;
+ assert (s1 != s2);
+ }
+}
return true;
}
}
+
+ // Allow compatiblity of struct subtypes in both ways
+ if (expect_struct.is_subtype_of (expr_struct)) {
+ return true;
+ }
}
return false;
return true;
}
+ if (base_struct != null) {
+ return base_struct.is_disposable ();
+ }
+
foreach (Field f in fields) {
if (f.binding == MemberBinding.INSTANCE
&& f.get_attribute_bool ("CCode", "delegate_target", true)