changeset 1455:a4dc53fd9f2e

[Issue 1087] Scope classes not destroyed in labeled statements in switches Jarrett Billingsley <jarrett.billingsley@gmail.com> 2007-03-30 http://d.puremagic.com/issues/show_bug.cgi?id=1087
author thomask
date Thu, 05 Apr 2007 10:18:36 +0000
parents 0c9905dc4158
children fe473839afc2
files run/s/scope_17_A.d run/s/scope_17_B.d run/s/scope_17_C.d run/s/scope_17_D.d
diffstat 4 files changed, 155 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/s/scope_17_A.d	Thu Apr 05 10:18:36 2007 +0000
@@ -0,0 +1,37 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Jarrett Billingsley <jarrett.billingsley@gmail.com>
+// @date@	2007-03-30
+// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=1087
+// @desc@	[Issue 1087] Scope classes not destroyed in labeled statements in switches
+
+module dstress.run.s.scope_17_A;
+
+int i[];
+
+scope class A{
+	~this(){
+		i ~= 3;
+	}
+}
+
+int main(){
+	i ~= 0;
+
+	goto L1;
+	{
+		L1:
+			scope a = new A();
+			scope(exit) i ~= 2;
+			i ~= 1;
+	}
+	i ~= 4;
+	
+	if([0, 1, 2, 3, 4] != i){
+		assert(0);
+	}
+
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/s/scope_17_B.d	Thu Apr 05 10:18:36 2007 +0000
@@ -0,0 +1,38 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Jarrett Billingsley <jarrett.billingsley@gmail.com>
+// @date@	2007-03-30
+// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=1087
+// @desc@	[Issue 1087] Scope classes not destroyed in labeled statements in switches
+
+module dstress.run.s.scope_17_B;
+
+int i[];
+
+scope class A{
+	~this(){
+		i ~= 3;
+	}
+}
+
+int main(){
+	i ~= 0;
+
+	switch(i.length)
+	{
+		case 1:
+			scope a = new A();
+			scope(exit) i ~= 2;
+			i ~= 1;
+			break;
+	}
+	i ~= 4;
+	
+	if([0, 1, 2, 3, 4] != i){
+		assert(0);
+	}
+
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/s/scope_17_C.d	Thu Apr 05 10:18:36 2007 +0000
@@ -0,0 +1,40 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Jarrett Billingsley <jarrett.billingsley@gmail.com>
+// @date@	2007-03-30
+// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=1087
+// @desc@	[Issue 1087] Scope classes not destroyed in labeled statements in switches
+
+module dstress.run.s.scope_17_C;
+
+int i[];
+
+scope class A{
+	~this(){
+		i ~= 3;
+	}
+}
+
+int main(){
+	i ~= 0;
+
+	switch(i.length)
+	{
+		case 1:
+			goto L2;
+		L2:
+			scope a = new A();
+			scope(exit) i ~= 2;
+			i ~= 1;
+			break;
+	}
+	i ~= 4;
+	
+	if([0, 1, 2, 3, 4] != i){
+		assert(0);
+	}
+
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/s/scope_17_D.d	Thu Apr 05 10:18:36 2007 +0000
@@ -0,0 +1,40 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Jarrett Billingsley <jarrett.billingsley@gmail.com>
+// @date@	2007-03-30
+// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=1087
+// @desc@	[Issue 1087] Scope classes not destroyed in labeled statements in switches
+
+module dstress.run.s.scope_17_D;
+
+int i[];
+
+scope class A{
+	~this(){
+		i ~= 3;
+	}
+}
+
+int main(){
+	i ~= 0;
+
+	switch(i.length)
+	{
+		L2:
+			scope a = new A();
+			scope(exit) i ~= 2;
+			i ~= 1;
+			break;
+		case 1:
+			goto L2;
+	}
+	i ~= 4;
+	
+	if([0, 1, 2, 3, 4] != i){
+		assert(0);
+	}
+
+	return 0;
+}