chibicc icon indicating copy to clipboard operation
chibicc copied to clipboard

Support assignment between structs

Open lynn opened this issue 2 years ago • 0 comments

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).

lynn avatar Jun 28 '23 21:06 lynn