www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - mixin ctors causes collisions.

reply "Regan Heath" <regan netwin.co.nz> writes:
import std.stdio;

class A {
	template ctor(Type)
	{
		this(Type[] arr)
		{
			foreach(Type v; arr) writefln(typeid(typeof(v)));
		}
	}

	//uncomment any one of these...
	//mixin ctor!(bit);
	//mixin ctor!(byte);
	//mixin ctor!(short);
	mixin ctor!(int);
	//mixin ctor!(long);
}

void main()
{
	static int[] ints = [0,1,2,3];
	A a = new A(ints);
}

Regan
Mar 16 2005
parent Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Regan Heath schrieb am Thu, 17 Mar 2005 00:02:14 +1300:
 import std.stdio;

 class A {
 	template ctor(Type)
 	{
 		this(Type[] arr)
 		{
 			foreach(Type v; arr) writefln(typeid(typeof(v)));
 		}
 	}

 	//uncomment any one of these...
 	//mixin ctor!(bit);
 	//mixin ctor!(byte);
 	//mixin ctor!(short);
 	mixin ctor!(int);
 	//mixin ctor!(long);
 }

 void main()
 {
 	static int[] ints = [0,1,2,3];
 	A a = new A(ints);
 }

 Regan
Added to DStress as http://dstress.kuehne.cn/run/mixin_09.d http://dstress.kuehne.cn/run/mixin_10.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCQHmd3w+/yD4P9tIRAqsiAJ9EJRx6P7mLKk0qedITHG5lpeewGgCfUDtV yPxW8ltpc+CeLDNT2b0UqA8= =f7SU -----END PGP SIGNATURE-----
Mar 22 2005