changeset 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 3a8bc4294d51
children 23b89cbbe105
files run/o/opSliceAssign_03_A.d
diffstat 1 files changed, 36 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /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 <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;
+}