view run/destructor_03.d @ 1:3414705c41ac

removed CVS header
author thomask
date Sun, 26 Sep 2004 12:06:09 +0000
parents 3269e4627918
children 33a25c1e1cfc
line wrap: on
line source


// @author@	Ilya Zaitseff <sark7@mail333.com>
// @date@	2004-08-06
// @uri@	news://opscahl7ddaaezs2@ilya.tec.amursk.ru

int status;

class MyClass{
	this(){
		status++;
	}
	
	~this(){
		status++;
		status*=3;
		throw new Exception("E2");
	}
}

int main(){
	try{
		auto MyClass m = new MyClass();
		assert(status == 1);
		delete m;
	}catch(Exception e){
		assert(status == 6);
		status/=3;
		status-=2;
	}
	
	assert( status == 0 );
	return 0;
}