[Issue 9912] New: Wrong codegen when using tuple over member variable in more than one method

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 9 07:36:39 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9912

           Summary: Wrong codegen when using tuple over member variable in
                    more than one method
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: ibuclaw at ubuntu.com


--- Comment #0 from Iain Buclaw <ibuclaw at ubuntu.com> 2013-04-09 07:36:38 PDT ---
GDC bug report:
http://bugzilla.gdcproject.org/show_bug.cgi?id=49

LDC bug report:
https://github.com/ldc-developers/ldc/issues/266

Minimal testcase:
---
template Tuple(Stuff ...) {
    alias Stuff Tuple;
}
struct S {
    int i;
    alias Tuple!i t;
    void a() {
        auto x = t;
    }
    void b() {
        auto x = t;
    }
}
---

Causes an ICE in gdc and ldc because the dotvar expression 'this.i' is cached
and re-used when building the tuple expression in both methods 'a' and 'b'. 
Meaning that both uses of 'this' is given the parent context of method 'a'.

This is a problem when you try to access the 'this' parameter of 'a' from the
function 'b'... Oops, you can't do that!


Problem is in the D frontend, and should be fixed.

-- 
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