aa bug?

bearophile bearophileHUGS at lycos.com
Tue Jul 28 17:20:00 PDT 2009


Saaa:

> struct S
> {
>   int i;
> }
> S[char[]] aa;
> void main() {
>   aa["test"].i = 10;
> }
> 
> Error: ArrayBoundsError
> D1.046

Try:

struct S { int i; }
S[char[]] aa;

void main() {
    aa["test"] = S(10);
}

In theory a Sufficiently Smart Compiler is able to optimize that code well.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list