view run/o/odd_bug_09_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 1ee9a0dd42d9
children
line wrap: on
line source

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

// @author@	Johan Granberg <lijat.meREM@OVEgmail.com>
// @date@	2006-09-14
// @uri@	http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.bugs&artnum=8389
// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=1034
// @desc@	Incorrect code generation -O2 gdc

module dstress.run.o.odd_bug_09_A;

struct S{
	union{
		void delegate(uint) del;
		void function(uint) fp;
	}
	static S opCall(void function(uint) c,uint i){
		S a;
		a.fp = c;
		return a;
	}
}

S s;

static this(){
	s = S(&foo, 0);
}

void foo(uint i){
}

int main(){
	foo(0);
	if(! s.fp){
		assert(0);
	}
	s.fp(0);

	return 0;
}