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

           Summary: Using alias this and a hash generates wrong code
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from Andrej Mitrovic <[email protected]> 2013-07-10 
07:54:54 PDT ---
-----
struct S
{
    bool b = true;

    bool test()
    {
        if (!b)  // note: must be a check, not 'return b;'
            return false;

        return true;
    }
}

struct Wrap
{
    int i;
    alias i this;
    S s;
}

void main()
{
    {
        Wrap[int] wrap;

        wrap[0] = Wrap();
        wrap[0].i = 0;

        assert(wrap[0].s.test());  // ok
    }

    {
        Wrap[int] wrap;

        wrap[0] = Wrap();
        wrap[0] = 0;  // note: using 'alias this' to assign

        assert(wrap[0].s.test());  // failure
    }
}
-----

It doesn't appear to be a regression.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to