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

           Summary: Swap and comma operator
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: timon.g...@gmx.ch


--- Comment #0 from timon.g...@gmx.ch 2011-03-30 13:19:58 PDT ---
Hello,

The following code fails the assertion:

import std.algorithm;
import std.stdio;

int main(){
    int a=1,b=0,c;
    swap(a,b),c=b;                                           
    assert(a==0);
    return 0;
}



(This one passes:

import std.stdio;

int main(){
    int a=1,b=0,c;
    tmp=b,b=a,a=tmp,c=b;                                      
    assert(a==0);
    return 0;
}

As well as this one: 

import std.algorithm;
import std.stdio;

int main(){
    int a=1,b=0,c;
    swap(a,b);c=b;                                           
    assert(a==0);
    return 0;
} )

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

Reply via email to