[Issue 14352] SDC test0075.d fails under against DMD

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Mar 28 09:33:46 PDT 2015


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

ag0aep6g at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ag0aep6g at gmail.com

--- Comment #1 from ag0aep6g at gmail.com ---
Slight reduction of transmogrify(0):

----
void main() {
    int[] output;
    switch (0) {
        case 0:
            output ~= 0;
            goto case;
            goto case;
        case 1:
            output ~= 1;
            goto case;
        case 2:
            output ~= 2;
            break;
        case 3:
            output ~= 3;
            break;
        default:
            assert(false);
    }
    import std.stdio;
    writeln(output);
}
----

Should print "[0, 1, 2]". Actually prints "[0, 1, 3]", meaning that it jumps
from case 1 to case 3.

Having more than one `goto case;` seems to confuse dmd.

--


More information about the Digitalmars-d-bugs mailing list