Integer constant expression expected instead of...

Era Scarecrow rtcvb32 at yahoo.com
Sun Sep 1 18:39:30 PDT 2013


On Monday, 2 September 2013 at 01:19:44 UTC, bearophile wrote:
> 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
>
> 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];

alias NString = immutable(char)[fieldEntryLength]; //works
alias NString = immutable(char[fieldEntryLength]); //fails

  I wonder why this is the case... It's a fixed number either 
way...


More information about the Digitalmars-d-learn mailing list