Integer constant expression expected instead of...

bearophile bearophileHUGS at lycos.com
Sun Sep 1 18:19:36 PDT 2013


Era Scarecrow:

> [code]
>   enum fieldEntryLength = 4;
>   //immutable fieldEntryLength = 4; //same issue
>   alias immutable(char[fieldEntryLength]) NString;
> [/code]
>
> test.d(10): Error: Integer constant expression expected instead 
> of fieldEntryLength
>
>
>  This breaks code that previously compiled. I really don't see 
> the problem... bug?

It could be a regression. You could file it in Bugzilla.

In the meantime this seems to work (I have also used the new 
alias syntax. Eventually the old alias syntax should be 
deprecated):

enum fieldEntryLength = 4;
alias NString = immutable(char)[fieldEntryLength];

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list