www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - template specialization bug

reply "Aleksey Bobnev" <uw front.ru> writes:
Specialization gets broken sometimes. It's possibly related to module
facility in D.

this works ok(outputs "1 0"):

template IsArray(T)        { static const bool IsArray = false; }
template IsArray(T : T[])  { static const bool IsArray = true; }

void main()
{
    printf("%d %d\n",IsArray!(int[]),IsArray!(int));
}

1. When some module, containing a bunch templates is imported,output is "0
0".
2. When template IsArray is moved into another module, containing other
templates as well,  output is "0 0".

However when I tried to isolate the bug by removing uninvolved templates, it
disappeared.
So I am including the complete code which causes the described behaviour.
Dec 27 2004
parent "Thomas Kuehne" <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Added to DStress as
http://dstress.kuehne.cn/run/template_10.d
http://dstress.kuehne.cn/run/template_11.d
http://dstress.kuehne.cn/run/template_12.d

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFB1ixn3w+/yD4P9tIRAubFAKC2Hpcw8S1eKC0qUs825IzIIOKXEwCguO3e
w+IkzgTEGHGbOHUF5GOKJ9U=
=oS/a
-----END PGP SIGNATURE-----
Dec 31 2004