view run/o/opSliceAssign_03_A.d @ 1236:f41655c00b51

[Issue 578] New: GDC evaluates rvalue of array assignment repeatedly Gregor Richards <akaquinn@hotmail.com> 2006-11-20 news:bug-578-31@http.d.puremagic.com/issues/
author thomask
date Sat, 25 Nov 2006 17:52:49 +0000
parents
children e6887749b811
line wrap: on
line source

// $HeadURL$
// $Date$
// $Author$

// @author@	Gregor Richards <akaquinn@hotmail.com>
// @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;
}