[Issue 9356] New: -inline with inout and append generates wrong code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 20 04:07:47 PST 2013


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 at puremagic.com
        ReportedBy: doob at me.com


--- Comment #0 from Jacob Carlborg <doob at 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: -------


More information about the Digitalmars-d-bugs mailing list