view run/s/scope_17_B.d @ 1630:d0efa3ae5522 default tip

run/mini/naked_asm5: New x86_64 ABI passes the arguments in reverse order.
author David Nadlinger <code@klickverbot.at>
date Sat, 23 Apr 2011 22:57:32 +0200
parents a4dc53fd9f2e
children
line wrap: on
line source

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

// @author@	Jarrett Billingsley <jarrett.billingsley@gmail.com>
// @date@	2007-03-30
// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=1087
// @desc@	[Issue 1087] Scope classes not destroyed in labeled statements in switches

module dstress.run.s.scope_17_B;

int i[];

scope class A{
	~this(){
		i ~= 3;
	}
}

int main(){
	i ~= 0;

	switch(i.length)
	{
		case 1:
			scope a = new A();
			scope(exit) i ~= 2;
			i ~= 1;
			break;
	}
	i ~= 4;
	
	if([0, 1, 2, 3, 4] != i){
		assert(0);
	}

	return 0;
}