view run/r/return_09_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 daef239f37cf
children
line wrap: on
line source

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

// @author@	Witold Baryluk <baryluk@mpi.int.pl>
// @date@	2006-10-19
// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=443
// @desc@	[Issue 443] New: assignment in return when using cdouble is broken

module dstress.run.r.return_09_A;

cdouble y;

cdouble f(cdouble x) {
    return (y = x);
}

int main() {
	cdouble z = f(1.0+2.0i);

	if(y.re != 1.0){
		assert(0);
	}
	if(y.im != 2.0){
		assert(0);
	}
	if(z.re != 1.0){
		assert(0);
	}
	if(z.im != 2.0){
		assert(0);
	}

	return 0;
}