Bug 21571 – goto across assignment to AA fails and reports false Error

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2021-01-21T15:35:01Z
Last change time
2024-12-13T19:14:15Z
Assigned to
No Owner
Creator
kdevel
Moved to GitHub: dmd#18018 →

Comments

Comment #0 by kdevel — 2021-01-21T15:35:01Z
~~~gotoskip.d int main () { string[string] aa; goto A; // line 4 aa["X"] = "Y"; // line 5 A: return 0; } ~~~ $ dmd gotoskip.d gotoskip.d(4): Error: goto skips declaration of variable gotoskip.main.__aaval2 at gotoskip.d(5) As mentioned by Paul Backus [1] the compiler generates a temporary for the assigned value: // goto A; (string __aaval2 = "Y";) , aa["X"] = __aaval2; A: [1] http://forum.dlang.org/thread/[email protected]#post-fplpglzhvxckvryubwsc:40forum.dlang.org
Comment #1 by robert.schadek — 2024-12-13T19:14:15Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18018 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB