Beef icon indicating copy to clipboard operation
Beef copied to clipboard

[Enhancement] Brace initialize const struct

Open blat-blatnik opened this issue 4 years ago • 2 comments

This doesn't work, but I think it should:

struct S { public int x, y; }
const S s = .{ x=42, y=314 };

If nothing else, then the error message should at least be changed. Currently it says "Expression does not evaluate to constant value".

blat-blatnik avatar Dec 15 '21 14:12 blat-blatnik

There's a better error at 0ee161c314a7786fd5ae4566d6391d830cd86e82 It would be nice to be able to have this actually supported, but it's non-trivial and likely won't happen any time soon

bfiete avatar Dec 16 '21 15:12 bfiete

Understandable. It's by no means crucial.

blat-blatnik avatar Jan 06 '22 17:01 blat-blatnik