view run/s/struct_28_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 3da73e4504c4
children
line wrap: on
line source

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

// @author@	Stewart Gordon <smjg@iname.com>
// @date@	2007-02-22
// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=997
// @desc@	[Issue 997] [Regression] Struct-returning function that conditionally passes the result of another function straight through doesn't work (NRVO bug?)

module dstress.run.s.struct_28_B;

struct Rect {
    int left, top, right, bottom;
}

Rect foo(bool indirect) {
	if(indirect){
		return defaultRect();
	}else{
		Rect result;
		return result;
	}
}

Rect defaultRect(){
	return Rect.init;
}

int main() {
	if(foo(false) != foo(true)){
		assert(0);
	}
	return 0;
}