Am 16.02.2015 um 18:55 schrieb Jonathan Marler:
Why is the 'in' operator nogc but the index operator is not?

void main() @nogc
{
     int[int] a;
     auto v = 0 in a; // OK
     auto w = a[0];   // Error: indexing an associative
                      // array in @nogc function main may
                      // cause GC allocation
}

Because the index operator throws a OutOfRange exception and throwing exceptions allocates, maybe?

Reply via email to