view run/n/nested_function_07_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 be2b20dc0eb4
children
line wrap: on
line source

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

// @author@	Fredrik Olsson <peylow@gmail.com>
// @date@	2005-11-30
// @uri@	news:dmjkbv$31is$1@digitaldaemon.com
// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=1033

module dstress.run.n.nested_function_07_A;

int outer(int a) {
	int inner(int b) {
		a += b;
		if (b > 0) {
			return inner(b - 1);
		} else {
			return a;
		}
	}
	return inner(a);
}

int main(char[][] args) {
	assert(outer(3) == 9);

	return 0;
}