view run/invariant_12.d @ 59:96cadd0da1ae

added invariant tests
author thomask
date Fri, 22 Oct 2004 20:29:58 +0000
parents
children e38919011244
line wrap: on
line source

module dstress.run.invariant_12.d;

class Parent{
	int x;

	void test(){
	}
	
	invariant{
		// even number
		assert(x&1==0);
	}
}

class Child : Parent{
}

class GrandChild : Child{
	this(){
		x=5;	
	}
}

int main(){
	try{
		GrandChild gc = new GrandChild();
	}catch{
		return 0;
	}
	assert(0);
}