[Issue 12640] New: @nogc introduces a spurious switch case fallthrough warning

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Apr 24 18:59:50 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12640

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

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



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
allocation
test.d(8,9): Warning: switch case fallthrough - use 'goto default;' if intended

--


More information about the Digitalmars-d-bugs mailing list