Bug 4226 – Can't forward reference identifier defined within a string mixin
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
Other
OS
Linux
Creation time
2010-05-23T10:10:00Z
Last change time
2014-02-15T02:16:40Z
Keywords
rejects-valid, spec
Assigned to
nobody
Creator
nfxjfg
Comments
Comment #0 by nfxjfg — 2010-05-23T10:10:54Z
$ cat f.d
const x = y;
mixin("const y = "~z~";");
const z = "123";
$ dmd f.d
f.d(1): Error: undefined identifier y, did you mean module f?
It works when you make the line with the mixin the first line.
I'm reporting this mainly because I'm curious whether this example is supposed to work (i.e. it's a dmd bug), or whether the specification disallows it. I think it is valid.
(Tested with dmd 1.061.)
Comment #1 by bugzilla — 2011-04-11T17:47:38Z
I think it should be a bug, though how fixable it is remains to be seen.
Comment #2 by k.hara.pg — 2013-11-22T00:32:12Z
*** This issue has been marked as a duplicate of issue 1170 ***