c3c icon indicating copy to clipboard operation
c3c copied to clipboard

Compiler crash with designated initializers

Open cbuttner opened this issue 1 year ago • 3 comments

bitstruct Flags : int {
  bool flag1;
}

struct Foo {
  long x;
  Flags flags;
}

fn int main(String[] args) {
  long x;
  Foo foo = {
    .x = x,
    .flags.flag1 = true, // Compiler crash here
  };
  return 0;
}

cbuttner avatar May 20 '24 08:05 cbuttner

This should now work.

lerno avatar May 20 '24 12:05 lerno

This fix broke assigning to bitstructs with designated initializers.

bitstruct Flags : int  {
  bool flag1;
}

struct Foo {
  long x;
  Flags flags;
}

fn int main(String[] args)
{
  long x;
  Flags flags;
  Foo foo = {
    .x = x,
    .flags = flags,
  };
  return 0;
}

cbuttner avatar May 20 '24 17:05 cbuttner

I'm sorry about that. It should work properly now.

lerno avatar May 20 '24 20:05 lerno

Looks fixed, thanks!

cbuttner avatar Jun 07 '24 10:06 cbuttner