You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code:
```string foo () { return null; }void main (){ if (auto str = foo()) { assert(str.length); L1: } else goto L1;}```
Produces "oa.d(10): Error: goto skips declaration of variable oa.main.str at oa.d(5)"
But the variable is not used after L1.
The text was updated successfully, but these errors were encountered:
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.
Mathias LANG (@Geod24) reported this on 2019-08-29T03:11:02Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=20179
CC List
Description
The text was updated successfully, but these errors were encountered: