view run/w/with_15_B.d @ 1128:02b54d874f0f

[Issue 325] New: Overriding members and overloading with alias causes bogus error messages in with(). Chris Miller <chris@dprogramming.com> 2006-09-06 news:bug-325-3@http.d.puremagic.com/issues/
author thomask
date Thu, 07 Sep 2006 07:51:37 +0000
parents
children daef239f37cf
line wrap: on
line source

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

// @author@	Chris Miller <chris@dprogramming.com>
// @date@	2006-09-06
// @uri@	news:bug-325-3@http.d.puremagic.com/issues/
// @desc@	[Issue 325] New: Overriding members and overloading with alias causes bogus error messages in with().

module dstress.run.w.with_15_B;

class Base{
	int data;

	void foo(int i){
		data = i;
	}
	int foo(){
		return data;
	}
}

class Derived : Base{
	override void foo(int i){
		super.data = 2 * i;
	}
	
	alias Base.foo foo;
}

int main(){
	Derived d = new Derived();
	with(d){
		foo = 1;
	}

	if(d.foo() != 2){
		assert(0);
	}

	return 0;
}