[Issue 24634] Parse error initializing array from expression with StructInitializer
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jun 29 10:01:39 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=24634
--- Comment #6 from Nick Treleaven <nick at geany.org> ---
basile-z is right that the compiler can't parse a struct initializer as part of
an expression. The ArrayLiteral spec was wrong - the pull fixes that.
Tom Kral:
> I find it rather surprising that StructInitializer would not work in this case. Is there a good reason for that?
It is part of a function argument, which in turn is part of an expression
initializer (because a function call is an expression). An expression cannot
parse all initializers because some initializers (e.g. `{}` for struct) mean
something else as an expression (a function literal). So initializers are not
accepted inside an expression.
--
More information about the Digitalmars-d-bugs
mailing list