[Issue 8626] New: Mixin forward reference semantic run leads to inconsistent AST

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 6 13:52:29 PDT 2012


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: nobody at puremagic.com
        ReportedBy: code at klickverbot.at


--- Comment #0 from klickverbot <code at klickverbot.at> 2012-09-06 13:52:33 PDT ---
See the discussion at
http://forum.dlang.org/thread/CAP9J_HV9YLEkwsFD=e3YT2Juxr0=Kb6sxJNnc2UP4Tr1qmz4+w@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: -------


More information about the Digitalmars-d-bugs mailing list