[Issue 7390] Missing switch case fallthrough warning with static foreach

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 3 10:24:33 UTC 2018


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

John Colvin <john.loughran.colvin at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john.loughran.colvin at gmail.
                   |                            |com

--- Comment #5 from John Colvin <john.loughran.colvin at gmail.com> ---
Another simple example:

void main()
{
    import std.stdio;
    import std.meta;
    switch (0)
    {
        foreach (i; AliasSeq!(0, 1))
        {
            case i:
                writeln(i);
        }
        default:
            writeln("other");
    }
}

Compiles fine without deprecations or warnings. This has caught me out multiple
times as I expect D to stop me making this mistake.

--


More information about the Digitalmars-d-bugs mailing list