Assigning a struct method to a delegate generates malformed C-Code
Submitted by Frederik Sdun
Link to original bug (#629600)
Description
If you assign a method to a delegate vala generates the following code:
delegate void FooFunc ();
struct Foo {
public FooFunc f;
public Foo () {
f = func;
}
public void func () {
}
}
void main () {
}
test.vala.c:45:21: error: incompatible types when assigning to type ‘gpointer’ {aka ‘void *’} from type ‘testee’ {aka ‘struct _testee’}
45 | (*self).f_target = (*self);
| ^
error: cc exited with status 256
Compilation failed: 1 error(s), 1 warning(s)
vala should assign the pointer and maybe even set the destroy_notify for the struct
Version: 0.9.x
Edited by Rico Tzschichholz