# HG changeset patch # User thomask # Date 1164477169 0 # Node ID f41655c00b5198cbdfaa7375410733ca1a3457bb # Parent 3a8bc4294d510e2ba988ea519719b07784fb4669 [Issue 578] New: GDC evaluates rvalue of array assignment repeatedly Gregor Richards 2006-11-20 news:bug-578-31@http.d.puremagic.com/issues/ diff -r 3a8bc4294d51 -r f41655c00b51 run/o/opSliceAssign_03_A.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/o/opSliceAssign_03_A.d Sat Nov 25 17:52:49 2006 +0000 @@ -0,0 +1,36 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Gregor Richards +// @date@ 2006-11-20 +// @uri@ news:bug-578-31@http.d.puremagic.com/issues/ +// @desc@ [Issue 578] New: GDC evaluates rvalue of array assignment repeatedly + +module dstress.run.o.opSliceAssign_03_A; + +int status; + +int test(){ + status++; + if(status != 1){ + assert(0); + } + return status; +} + +int main(){ + int[10] a; + a[] = test(); + + if(a.length != 10){ + assert(0); + } + foreach(int i; a){ + if(i != 1){ + assert(0); + } + } + + return 0; +}