www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13060] New: nogc reading an associative array


          Issue ID: 13060
           Summary:  nogc reading an associative array
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

void foo(int[int] aa)  nogc {
    auto y = aa[0];
void main() {}

Gives with dmd 2.066beta1:

test.d(2,16): Error: indexing an associative array in  nogc function foo may
cause GC allocation

AA.rehash could cause memory allocations, but looking for a key in an
associative could be regarded as  nogc.

Jul 06 2014