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

yebblies <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #3 from yebblies <[email protected]> ---
(In reply to Andrej Mitrovic from comment #1)
> Also, the same thing happens with 'goto', although I'm not sure whether
> there's a semantic difference between the two (I assume so).

If by that you mean replacing the 'break LSwitch' with 'goto LSwitch' then the
warning is correct, because that would be an infinite loop.

The problem here is that LabelStatement::blockExit just returns the blockExit
of the labeled statement, and isn't really designed for handling a label
containing a goto to itself.

BreakStatement::blockExit produces BEgoto when used with a label, but this is
overly vague, as labeled breaking from a switch should produce BEfallthru.

I tried changing SwitchStatement::blockExit to treat an internal BEgoto as
BEfallthrough, like ForStatement does, but it seems to also use BEgoto to
indicate internal 'goto case's and that change leads to false positive "no
return exp; or assert(0)" errors.

I'm not sure it's possible to fix this without properly building and walking a
CFG, maybe somebody else knows for sure.

--

Reply via email to