view run/f/forward_reference_19_A.d @ 1576:b3e16c86558e

[Issue 1398] New: GDC doesn't generate correct code <mariusmuja@gmail.com> 2007-08-04 http://d.puremagic.com/issues/show_bug.cgi?id=1398
author thomask
date Thu, 21 Feb 2008 15:20:08 +0000
parents e489e020a55d
children
line wrap: on
line source

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

// @author@	<vlasov@scatt.com>
// @date@	2007-03-12
// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=1058
// @desc@	[Issue 1058] DMD hangs with 100% CPU - member function returning forward-referenced struct before constructor

module dstress.run.f.forward_reference_19_A;

class A{
	B x;

	B b(){
		return x;
	}
}

struct B{
	int dummy;
}

int main(){
	A a = new A();
	B b;
	b.dummy = 0x12EF34AB;
	a.x = b;
	if(0x12EF34AB != a.b().dummy){
		assert(0);
	}

	return 0;
}