changeset 395:8b1e3fb9c5a5

added test for destructor sequence of auto variables
author thomask
date Wed, 06 Apr 2005 20:12:25 +0000
parents 2568b5ff35c0
children 70b2268df736
files run/auto_06.d
diffstat 1 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/auto_06.d	Wed Apr 06 20:12:25 2005 +0000
@@ -0,0 +1,31 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+module dstress.run.auto_06;
+
+int status;
+
+auto class A{
+	int cond;
+
+	this(int cond){
+		this.cond=cond;
+	}
+
+	~this(){
+		assert(status==cond);
+		status--;
+	}
+}
+
+void test(){
+	auto A a = new A(-1);
+	auto A b = new A(0);
+}
+
+int main(){
+	test();
+	assert(status==-2);
+	return 0;
+}