[Issue 5798] Swap and comma operator silently fails

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 30 14:12:24 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5798


kennytm at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kennytm at gmail.com


--- Comment #1 from kennytm at gmail.com 2011-03-30 14:08:55 PDT ---
Test case that does not depend on Phobos:


void assign9(ref int lhs) pure {
    lhs = 9;
}

void assign8(ref int rhs) pure {
    rhs = 8;
}

int main(){
    int a=1,b=2;
    assign8(b),assign9(a);
    assert(a == 9);
    assert(b == 8);   // <-- fail

    assign9(b),assign8(a);
    assert(a == 8);
    assert(b == 9);   // <-- fail

    return 0;
}


Removing the 'pure' attributes make all asserts pass.

-- 
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