view run/u/union_17_C.d @ 1319:81222734adf3

sed'ed replacement of new:...http.d.puremagic.co... with http://d.puremagic.com/issues/show_bug.cgi?...
author thomask
date Sun, 31 Dec 2006 19:58:06 +0000
parents 439495a3c7c4
children
line wrap: on
line source

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

// @author@	<h3r3tic@mat.uni.torun.pl>
// @date@	2006-05-27
// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=158

module dstress.run.u.union_17_C;

struct Bar {
	union {
		union {
			Foo f;
		}
	}
}

struct Foo {
	int i;
}

static if(Foo.sizeof != Bar.sizeof){
	static assert(0);
}

int main(){
	Foo a;
	a.i = 2;
	
	Bar b;
	b.f = a;

	a.i = 3;
	
	if(a.i != 3){
		assert(0);
	}

	if(b.f.i != 2){
		assert(0);
	}

	return 0;
}