[Issue 16521] Wrong code generation with switch + static foreach

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 9 19:38:44 UTC 2018


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

Seb <greensunny12 at gmail.com> changed:

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

--- Comment #11 from Seb <greensunny12 at gmail.com> ---
FWIW this works with static foreach


---
void main ()
{
    sformat(0, uint.max);
}

void sformat (Args...) (int index, Args args)
{
JT: switch (index)
    {
        static foreach (idx, unused; args)
        {
        case idx:
            assert(unused == args[idx], "Borken compiler");
            break JT;
        }

    default:
        assert(0);
    }
}
---

https://run.dlang.io/is/eJvNFB

--


More information about the Digitalmars-d-bugs mailing list