broken codegen when assigning derived type to property with base type inside constructor initializer
class Baz {
public string s = "bar";
}
class Bar : Baz {
}
class Foo {
public Baz baz { get; set; }
public Baz faz { get; owned set; }
}
void main() {
var foo = new Foo () {
baz = new Bar (),
faz = new Bar ()
};
assert (foo.baz.s == "bar");
assert (foo.faz.s == "bar");
}
produces:
test.vala.c: In function ‘_vala_main’:
test.vala.c:44:55: error: lvalue required as left operand of assignment
44 | #define _baz_unref0(var) ((var == NULL) ? NULL : (var = (baz_unref (var), NULL)))
| ^
test.vala.c:709:2: note: in expansion of macro ‘_baz_unref0’
709 | _baz_unref0 ((Baz*) _tmp0_);
| ^~~~~~~~~~~
test.vala.c:44:55: error: lvalue required as left operand of assignment
44 | #define _baz_unref0(var) ((var == NULL) ? NULL : (var = (baz_unref (var), NULL)))
| ^
test.vala.c:711:2: note: in expansion of macro ‘_baz_unref0’
711 | _baz_unref0 ((Baz*) _tmp1_);
| ^~~~~~~~~~~
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)