www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9356] New: -inline with inout and append generates wrong code

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

           Summary: -inline with inout and append generates wrong code
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: doob me.com


--- Comment #0 from Jacob Carlborg <doob me.com> 2013-01-20 04:07:46 PST ---
The assert in "foo" passes, which it obviously shouldn't.

inout(char)[] bar (inout(char)[] a)
{
    return a;
}

void foo (string str)
{
    string result;
    result ~= bar(str);
    assert(result == "!");
}

void main ()
{
    foo("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
}

If I remove "inout" in "bar" or the append in "foo" the code work as expected.
What "result" will actually be depends on the length of the string passed to
"foo".

I've only tried this with on Mac OS X, both 32 and 64bit.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 20 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9356


Denis Shelomovskij <verylonglogin.reg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |verylonglogin.reg gmail.com
           Severity|normal                      |major


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