www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10595] New: Using alias this and a hash generates wrong code

reply d-bugmail puremagic.com writes:
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: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 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: -------
Jul 10 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10595


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-09-22 10:42:55 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2539

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 22 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10595



--- Comment #2 from github-bugzilla puremagic.com 2013-09-22 13:04:29 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/0c965af287534093c0282480019b5d8749046357
fix Issue 10595 - Using alias this and a hash generates wrong code

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 22 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10595


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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