chibicc
chibicc copied to clipboard
Support assignment between structs
If x and y are structs of the same type, y = x should copy all the fields, maybe using something like memcpy.
A test that should pass:
assert(9, ({ struct {int a; int b; int c;} x = {2,3,4}, y = {0,0,0}; y = x; y.a + y.b + y.c; }),
"struct {int a; int b; int c;} x = {2,3,4}, y = {0,0,0}; y = x; y.a + y.b + y.c;");
Right now it returns 2 (so we are only copying the first field).