[Issue 13455] New: Side effects of comma operator not evaluated for empty 'expression tuple' right hand side

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Sep 10 12:02:18 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13455

          Issue ID: 13455
           Summary: Side effects of comma operator not evaluated for empty
                    'expression tuple' right hand side
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: timon.gehr at gmx.ch

The following code compiles and runs with failing assertions with DMD 2.066.0,
but it should compile and run with both assertions passing.

import std.stdio;
alias Seq(T...)=T;
int line;
void fun(T...)(T args,Seq!() x=(line=__LINE__,Seq!().init)){
    writeln("args: ",args,"\nline: ",line);
}
void main(){
    fun(2,"123"); assert(line==__LINE__);
    int i=0;
    auto x=(i++,Seq!());
    writeln(i);
    assert(i==1);
}

--


More information about the Digitalmars-d-bugs mailing list