http://d.puremagic.com/issues/show_bug.cgi?id=8626
Summary: Mixin forward reference semantic run leads to
inconsistent AST
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: major
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from klickverbot <[email protected]> 2012-09-06 13:52:33 PDT
---
See the discussion at
http://forum.dlang.org/thread/CAP9J_HV9YLEkwsFD=e3YT2Juxr0=kb6sxjnnc2up4tr1qmz...@mail.gmail.com,
this bug is just to make sure the issue doesn't get lost.
---
mixin template mix7974() {
uint _x;
}
struct Foo7974 {
immutable fa = Foo7974(0);
this(uint x) {
_x = x;
}
mixin mix7974!();
}
---
To recapitulate, the issue in the snippet is that the full semantic pass for
mix7974, including the arrayCopy() of its members to the surrounding scope, is
run twice at two separate points in time. Some parts of the resulting AST
reference the _x declaration from the first run, and some that from the second.
Looking at TemplateMixin::semantic, this behavior seems to be somewhat
intended, but the outcome is a bug, as Walter confirmed (and a major problem
for LDC codegen).
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------