[Issue 19213] goto skips declaration of variable in std.algorithm.iteration.joiner

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 17 20:38:54 UTC 2018


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

kinke at gmx.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kinke at gmx.net

--- Comment #5 from kinke at gmx.net ---
While I'm not convinced the `goto`s in the `pop{Front,Back}EmptyElements`
mixins in Phobos are the most elegant way of expressing the logic, the issue is
that the frontend warns about a skipped *temporary* variable declaration, whose
lifetime doesn't extend to the goto target.

It may be enough to exclude `STC.temp` vars from the error, just like for
`STC.exptemp` in
https://github.com/dlang/dmd/blob/06d579823bddf8cae735408f6cc81d4789ace520/src/dmd/statement.d#L2270.
I think the temporaries are bound to their statement (which cannot cross the
goto label) but I'm not 100% sure that's always the case.

--


More information about the Digitalmars-d-bugs mailing list