view run/s/struct_27_A.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 9084482d7c1e
children
line wrap: on
line source

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

// @author@	Alan Knowles <alan@akbkhome.com>
// @date@	2007-01-12
// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=832
// @desc@	[Issue 832] NRVO: return inside foreach results in junk

module dstress.run.s.struct_27_A;

struct S{
	int i;
	long _forec_nrvo;
}

S first(){
	foreach(element; s){
		if(2 != element.i){
			assert(0);
		}
		return element;
	}
}

S[1] s;

int main(){
	s[0].i = 2;
	if(2 != first().i){
		assert(0);
	}

	return 0;
}