changeset 1278:b644bef333ff

[Issue 500] New: Cannot assign to delegate during definition Marsell <marsell_pk@yahoo.com> 2006-11-13 news:bug-500-3@http.d.puremagic.com/issues/
author thomask
date Sat, 23 Dec 2006 19:47:26 +0000
parents 06c7337c4bd6
children 23fe17e22a63
files run/d/delegate_20_A.d run/d/delegate_20_B.d
diffstat 2 files changed, 57 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/d/delegate_20_A.d	Sat Dec 23 19:47:26 2006 +0000
@@ -0,0 +1,29 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Marsell <marsell_pk@yahoo.com>
+// @date@	2006-11-13
+// @uri@	news:bug-500-3@http.d.puremagic.com/issues/
+// @desc@	[Issue 500] New: Cannot assign to delegate during definition
+
+module dstress.run.d.delegate_20_A;
+
+int main(){
+	int i;
+
+	int delegate() dg;
+	dg = { return ++i; };
+
+	if(dg() != 1){
+		assert(0);
+	}
+	if(dg() != 2){
+		assert(0);
+	}
+	if(i != 2){
+		assert(0);
+	}
+
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/d/delegate_20_B.d	Sat Dec 23 19:47:26 2006 +0000
@@ -0,0 +1,28 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Marsell <marsell_pk@yahoo.com>
+// @date@	2006-11-13
+// @uri@	news:bug-500-3@http.d.puremagic.com/issues/
+// @desc@	[Issue 500] New: Cannot assign to delegate during definition
+
+module dstress.run.d.delegate_20_B;
+
+int main(){
+	int i;
+
+	int delegate() dg = { return ++i; };
+
+	if(dg() != 1){
+		assert(0);
+	}
+	if(dg() != 2){
+		assert(0);
+	}
+	if(i != 2){
+		assert(0);
+	}
+
+	return 0;
+}