[Issue 20179] 'goto' skips over declaration triggered for unused variable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 18 11:06:29 UTC 2023


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305 at gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
The compiler does not do any dataflow analysis so it cannot know whether `str`
is used or not below L1. However, `str` could be used, therefore the compiler
is conservative in this case and errors. In most cases, I think that the error
could actually prevent wrong code.

Anyway, if last use analysis is implemented for move constructors/perfect
fordwarding maybe this will have a chance of being fixed, however, chances are
slim.

--


More information about the Digitalmars-d-bugs mailing list