www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12523] New: false type deduced with inout append

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

           Summary: false type deduced with inout append
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: code dawg.eu



cat > bug.d << CODE
inout(T)[] dup(T)(inout(T)[] a)
{
    inout(T)[] res;
    foreach (ref e; a) // works without ref
        res ~= e;
    return res;
}

struct S
{
    void *p;
}

void foo()
{
    S[] m;
    m = dup(m);
}
CODE

dmd -c bug.d
----
Error: cannot append type inout(const(S)) to type inout(S)[]
----

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 05 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12523




The const is added here.
https://github.com/D-Programming-Language/dmd/blob/aac09e539f7c3d9bd882d05f5c331f64733c6a29/src/statement.c#L1602

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 05 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12523


Martin Nowak <code dawg.eu> changed:

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



https://github.com/D-Programming-Language/dmd/pull/3424

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 05 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12523




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/b8669836b696742709042aaa1b4cf4c8970bcc57
fix Issue 12523 - wrong type deduced for foreach ref argument

- No need to change the storage class because the var type
  already has inferred modifiers.

https://github.com/D-Programming-Language/dmd/commit/6d10394b33fea5e20a946b6f748239ee4a0e5076


fix Issue 12523 - wrong type deduced for foreach ref argument

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 05 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12523


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

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


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