changeset 800:6662d67963c0

Sean Kelly <sean@f4.ca> 2006-01-24 news:dr5uqg$2hn7$1@digitaldaemon.com
author thomask
date Wed, 25 Jan 2006 08:04:01 +0000
parents c67acdbaf88e
children 7ff5fd560b1d
files run/destructor_04.d
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/run/destructor_04.d	Wed Jan 25 08:03:40 2006 +0000
+++ b/run/destructor_04.d	Wed Jan 25 08:04:01 2006 +0000
@@ -8,27 +8,32 @@
 
 module dstress.run.destructor_04;
 
+bool hadDtor = false;
+
 class MyClass{
 	this(){
 		throw new Exception("dummy");
 	}
 
 	~this(){
+		hadDtor = true;
 		throw new Exception("should never throw");
+		
 	}
 }
 
 int main(){
 	MyClass c;
 
-	bool caught=false;
 	try{
 		c = new MyClass();
 	}catch{
-		caught=true;	
+		if(!hadDtor){
+			return 0;
+		}else{
+			assert(0);
+		}
 	}
-	
-	assert(caught);
 
-	return 0;
+	assert(0);
 }