[Issue 21571] New: goto across assignment to AA fails and reports false Error
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jan 21 15:35:01 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=21571
Issue ID: 21571
Summary: goto across assignment to AA fails and reports false
Error
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: kdevel at vogtner.de
~~~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/zodxcypeddafyqruzxnw@forum.dlang.org#post-fplpglzhvxckvryubwsc:40forum.dlang.org
--
More information about the Digitalmars-d-bugs
mailing list