view run/t/template_33_C.d @ 1514:891196dcfc3a

[Issue 1068] stack corruption with mixins and function templates Tomasz Stachowiak <h3r3tic@mat.uni.torun.pl> 2007-03-19 http://d.puremagic.com/issues/show_bug.cgi?id=1068
author thomask
date Wed, 25 Apr 2007 17:46:32 +0000
parents 5511f9277078
children
line wrap: on
line source

// $HeadUR$
// $Date$
// $Author$

// @author@	Dave <Dave_member@pathlink.com>
// @date@	2006-03-18
// @uri@	news:dvgq34$22hv$1@digitaldaemon.com

module dstress.run.t.template_33_C;

template sum(creal x){
	static if (x.re <= 1.0L){
		const creal sum = x;
	}else{
		const creal sum = x + sum!(x - 1.0L);
	}
}

int main(){
	creal x = sum!(3.0L + 0.0Li);

	if(x != 6.0L + 0.0Li){
		assert(0);
	}

	return 0;
}