Associative arrays give compile error

Bob Cowdery bob at bobcowdery.plus.com
Tue Oct 5 03:57:22 PDT 2010


 On 05/10/2010 11:45, Denis Koroskin wrote:
> On Tue, 05 Oct 2010 14:23:47 +0400, Bob Cowdery
> <bob at bobcowdery.plus.com> wrote:
>
>>  I can't seem to get any sense out of associative arrays. Even the
>> simplest definition won't compile so I must be doing something daft.
>>
>> int[string] aa = ["hello":42];
>>
>> Error: non-constant expression ["hello":42]
>>
>> What exactly is not constant about this. The example is straight out the
>> book. Using D 2.0.
>>
>> bob
>
> What exactly compiler version are you using (run dmd with no args)?
> Works perfectly fine here (dmd2.049).

It says 2.049. How odd. I've got a fair amount of code and everything
else compiles fine.


More information about the Digitalmars-d-learn mailing list