www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Mixin's adding virtual functions.. conflict

reply "Regan Heath" <regan netwin.co.nz> writes:
I'm fairly sure this should work.

--[bug7.d.d]--
template readT(T)
{
	void read(out T x) {}
}

template TReader()
{
	version(good) {
		void read(out byte x) {}
		void read(out ubyte x) {}
	}
	
	version(bad) {
		mixin readT!(byte);
		mixin readT!(ubyte);
	}
}

class A {
	mixin TReader;
}

void main(){
	A a = new A();
	byte b;
	a.read(b);
}

C:\Library\D\src\temp>dmd bug7.d -version=good
C:\Library\D\dmd\bin\..\..\dm\bin\link.exe bug7,,,user32+kernel32/noi;

C:\Library\D\src\temp>dmd bug7.d -version=bad
bug7.d(3): function bug7.A.TReader!() TReader_.readT!(byte) readT_g.read  
conflic
ts with bug7.A.TReader!() TReader_.readT!(ubyte) readT_h.read at bug7.d(3)

Regan
Jun 09 2005
parent Thomas Kuehne <thomas-dloop kuehne.this-is-spam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Regan Heath schrieb am Fri, 10 Jun 2005 14:09:30 +1200:
 I'm fairly sure this should work.

 --[bug7.d.d]--
 template readT(T)
 {
 	void read(out T x) {}
 }

 template TReader()
 {
 	version(good) {
 		void read(out byte x) {}
 		void read(out ubyte x) {}
 	}
 	
 	version(bad) {
 		mixin readT!(byte);
 		mixin readT!(ubyte);
 	}
 }

 class A {
 	mixin TReader;
 }

 void main(){
 	A a = new A();
 	byte b;
 	a.read(b);
 }

 C:\Library\D\src\temp>dmd bug7.d -version=good
 C:\Library\D\dmd\bin\..\..\dm\bin\link.exe bug7,,,user32+kernel32/noi;

 C:\Library\D\src\temp>dmd bug7.d -version=bad
 bug7.d(3): function bug7.A.TReader!() TReader_.readT!(byte) readT_g.read  
 conflic
 ts with bug7.A.TReader!() TReader_.readT!(ubyte) readT_h.read at bug7.d(3)
Added to DStress as http://dstress.kuehne.cn/run/o/overload_25_A.d http://dstress.kuehne.cn/run/o/overload_25_B.d http://dstress.kuehne.cn/nocompile/o/overload_25_C.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCqowC3w+/yD4P9tIRAlckAJ97rmY3O+V0uib1/eksySK8mu6n/gCeNbP4 uOko4XtHRj3gH4DOHcS54wY= =FGgT -----END PGP SIGNATURE-----
Jun 11 2005