www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10063] New: inout+pure results in ability to produce immutable reference to mutable data

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10063

           Summary: inout+pure results in ability to produce immutable
                    reference to mutable data
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: verylonglogin.reg gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg gmail.com> 2013-05-11
05:12:50 MSD ---
This code compiles but shouldn't:
---
inout(void)* f(inout void* p) pure
{ return p; }

immutable(void)* g(inout int* p) pure
{ return f(p); }
---

Explicit or implicit cast is required for this issue to appear. Change `g` to
accept `void*` instead of `int*` to see expected compilation error.

Another test-case:
---
struct S
{
    uint* p;

    inout(void)* f() pure inout
    { return p; }

    immutable(void)* g() pure inout
    { return f(); }
}
---

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



--- Comment #1 from github-bugzilla puremagic.com 2013-05-13 07:46:50 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/0dc34e8bf8dcbb7a16f4de197b902e83cbb21306
fix Issue 10063 - inout+pure results in ability to produce immutable reference
to mutable data

https://github.com/D-Programming-Language/dmd/commit/3d7f0374d99f94307e5dd3694594ac3b172ecbae
Merge pull request #2031 from 9rnsr/fix10063

Issue 10063 - inout+pure results in ability to produce immutable reference to
mutable data

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


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

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


--- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2013-05-18 08:11:53 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2031

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