changeset 1123:48fc88ca588a

[Issue 306] New: dmd 165 breaks existing code <someidiot@earthlink.net> 2006-08-23 news:bug-306-3@http.d.puremagic.com/issues/
author thomask
date Sun, 03 Sep 2006 09:20:14 +0000
parents 1430561a2f89
children 6d6c3e53a7a1
files run/d/delegate_19_A.d run/d/delegate_19_B.d
diffstat 2 files changed, 104 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/d/delegate_19_A.d	Sun Sep 03 09:20:14 2006 +0000
@@ -0,0 +1,50 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	<someidiot@earthlink.net>
+// @date@	2006-08-23
+// @uri@	news:bug-306-3@http.d.puremagic.com/issues/
+// @desc@	[Issue 306] New: dmd 165 breaks existing code
+
+module dstress.run.d.delegate_19_A;
+
+int status;
+
+void append (char[] content){
+	status++;
+}
+
+void append (char[] delegate() dg){
+	status--;
+}
+
+int main(){
+	char[] s = "abc";
+	
+	char[] dummy(){
+		return "123";
+	}
+
+	append(s);
+	if(status != 1){
+		assert(0);
+	}
+
+	append(dummy);
+	if(status != 2){
+		assert(0);
+	}
+
+	append(&dummy);
+	if(status != 1){
+		assert(0);
+	}
+	
+	append(dummy());
+	if(status != 2){
+		assert(0);
+	}
+
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/d/delegate_19_B.d	Sun Sep 03 09:20:14 2006 +0000
@@ -0,0 +1,54 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	<someidiot@earthlink.net>
+// @date@	2006-08-23
+// @uri@	news:bug-306-3@http.d.puremagic.com/issues/
+// @desc@	[Issue 306] New: dmd 165 breaks existing code
+
+module dstress.run.d.delegate_19_B;
+
+int status;
+
+class X{
+	void append (char[] content){
+		status++;
+	}
+
+	void append (char[] delegate() dg){
+		status--;
+	}
+}
+
+int main(){
+	char[] s = "abc";
+	
+	char[] dummy(){
+		return "123";
+	}
+
+	X x = new X();
+
+	x.append(s);
+	if(status != 1){
+		assert(0);
+	}
+
+	x.append(dummy);
+	if(status != 2){
+		assert(0);
+	}
+
+	x.append(&dummy);
+	if(status != 1){
+		assert(0);
+	}
+	
+	x.append(dummy());
+	if(status != 2){
+		assert(0);
+	}
+
+	return 0;
+}