view run/i/invariant_33_A.d @ 1603:2031b04871b3

Fix broken invariant + synchronized test. Synchronized is not a valid function attribute for structs!
author Christian Kamm <kamm incasoftware de>
date Sat, 28 Mar 2009 19:17:32 +0100
parents ec5e144583ea
children
line wrap: on
line source

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

// @author@	<torhu@yahoo.com>
// @date@	2007-04-12
// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=1135
// @desc@	[Issue 1135] invariant keyword parsing is messed up

// __DSTRESS_TORTURE_BLOCK__ -release

module dstress.run.i.invariant_33_A;

int state;

class X{
	synchronized invariant(){
		int x;
		state += ++x;
	}

	void foo(){
	}
}

int main(){
	X x = new X();

	x.foo();
	if(2 != state){
		assert(0);
	}

	x.foo();
	if(4 != state){
		assert(0);
	}
	
	x.foo();
	if(6 != state){
		assert(0);
	}
	return 0;
}