[Issue 18605] False unreachable warning generated when labeled continue is used

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 13 15:40:50 UTC 2018


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

--- Comment #1 from Yuxuan Shui <yshuiv7 at gmail.com> ---
This bug is worse than I thought:

auto test(T...)(int t) pure {
    L:foreach(_; T) {
        if (t)
            continue L;
        return 1;
    }
}

void main() @safe {
    import std.stdio : writeln;
    writeln(test!(1,2,3)(1));
}

Results in an uninitialized return value in @safe code.

--


More information about the Digitalmars-d-bugs mailing list