Bug 13455 – Side effects of comma operator not evaluated for empty 'expression tuple' right hand side
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2014-09-10T19:02:18Z
Last change time
2020-03-21T03:56:31Z
Assigned to
No Owner
Creator
timon.gehr
Comments
Comment #0 by timon.gehr — 2014-09-10T19:02:18Z
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);
}
Comment #1 by b2.temp — 2019-03-20T21:41:35Z
problem was solved differently since using the result of comma expr is not allowed anymore