[Issue 24763] Can't use struct initializer in an array literal
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Sep 13 09:35:38 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=24763
Nick Treleaven <nick at geany.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nick at geany.org
Summary|Can't initialize a struct |Can't use struct
|with a static array |initializer in an array
| |literal
--- Comment #3 from Nick Treleaven <nick at geany.org> ---
> `a = {test: 1};` is an assign expression and the struct initalizer is not an expression. I think this all could be simplified and indeed the struct initializer should be accepted as an expression
Well then the parser would have to look ahead in function literals for a
semi-colon after an arbitrarily complex expression statement. Unless we make
`{...}` not a function literal and require `(){...}`.
--
More information about the Digitalmars-d-bugs
mailing list