Open sternenseemann opened 3 years ago
ah yes, closures can't be assigned to local variables. i dont know why, this looks like a bug.
oh i remember why. fixing this is hard because closures are emitted as structures for capture context. this is a corner case where there's no special assignment case in symbolic, its just passed as literal = into C, and using = for structs is not legal in C. We'd either need yet another special case or finally some more generic way to assignment.
C should handle = for structs AFAIK...
struct foo { void * p; int i; };
struct foo test() {
struct foo a = {0,1};
struct foo b;
b = a;
return b;
}
Taken from the README with fixed syntax:
Compiling fails: