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

--- Comment #3 from Martin Nowak <c...@dawg.eu> ---
I think something along this line could work.

override void visit(ConditionalStatement s)
{
    if (s.condition.include(null, null))
    {
        result = s.ifbody.blockExit(func, mustNotThrow);
        // mark as conditional fallthru, see Bugzilla 14835
        if (!s.elsebody) result |= BEconditional;
    }
    else if (s.elsebody)
        result = s.elsebody.blockExit(func, mustNotThrow);
    else
        result = BEfallthru;
}

if (!(result & (BEfallthru | BEconditional)) && !s.comeFrom())
{
    if (s.blockExit(func, mustNotThrow) != BEhalt && s.hasCode())
        s.warning("statement is not reachable");
}

But for this to work ConditionalStatement must no longer be flattened before
computing blockExit, thus making this change very big (and somewhat risky).

--

Reply via email to