view run/destructor_03.d @ 1383:52c9e86b6486

@url@ -> @uri@
author thomask
date Sun, 04 Mar 2007 13:07:35 +0000
parents a33ad7189d21
children 6e4063f99377
line wrap: on
line source

// $HeadURL$
// $Date$
// $Author$

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

module dstress.run.destructor_03;

int status;

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

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