November 11, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8998

           Summary: 'inout pure' returns immutable, which in reality is
                    mutable
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: acehreli@yahoo.com


--- Comment #0 from Ali Cehreli <acehreli@yahoo.com> 2012-11-11 15:25:20 PST ---
class A
{
    int i;
}

class C
{
    A a;

    this()
    {
        a = new A();
    }

    // WRONG: Returns immutable(A)
    immutable(A) get() inout pure
    {
        return a;
    }
}

void main()
{
    auto c = new C;

    immutable(A) imm_a = c.get();
    assert(imm_a.i == 0);

    c.a.i = 100;              // <-- changes immutable(A)
    assert(imm_a.i == 100);   // <-- Oops!
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 12, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8998


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |k.hara.pg@gmail.com,
                   |                            |yebblies@gmail.com


--- Comment #1 from yebblies <yebblies@gmail.com> 2013-01-13 03:16:34 EST ---
This looks similar to issue 9230.  It it possible this case slipped through the cracks?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 20, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8998


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid, pull


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2013-01-20 08:34:18 PST ---
https://github.com/D-Programming-Language/dmd/pull/1519

(In reply to comment #1)
> This looks similar to issue 9230.  It it possible this case slipped through the cracks?

No. Essentially, this is a regression which has been caused by fixing issue 7769. See the description in my pull request.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 04, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8998



--- Comment #3 from github-bugzilla@puremagic.com 2013-03-03 16:07:29 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/49b4d94ce98437f408f6c84b9afc36f141c01d5a fix Issue 8998 - 'inout pure' returns immutable, which in reality is mutable

By fixing issue 7769 (relax inout rule), we cannot assume a function with inout parameters as PUREstrong, because the return type may not have any inout indirections.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 04, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8998


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Top | Discussion index | About this forum | D home