www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12640] New: nogc introduces a spurious switch case


          Issue ID: 12640
           Summary:  nogc introduces a spurious switch case fallthrough
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

void main()  nogc {
    int[1] bar;
    int x;
    switch (x) {
        case 0:
            bar = [x];

DMD 2.066alpha gives this, the warning is false (a rejects-valid, you can see
it removing the  nogc annotation):

test.d(6,19): Error: array literals in  nogc function main may cause GC
test.d(8,9): Warning: switch case fallthrough - use 'goto default;' if intended

Apr 24 2014