why array do not support gcc style Initialize way?

Roberto Rosmaninho robertogrosmaninho at gmail.com
Wed Sep 11 20:36:03 UTC 2019


On Wednesday, 11 September 2019 at 19:19:51 UTC, Paul Backus 
wrote:
> For details, see the D language specification's section on 
> static array initialization:
> https://dlang.org/spec/arrays.html#static-init-static

Hey, at this section the code below:

enum Color { red, blue, green };

int[Color.max + 1] value =
   [ Color.blue :6,
     Color.green:2,
     Color.red  :5 ];

Produces the output “onlineapp.d(4): Deprecation: use `{ }` for 
an empty statement, not `;`” when I executed it.

Any clues of why it’s happened?


More information about the Digitalmars-d mailing list