[Issue 617] New: IFTI doesn't use normal promotion rules for non-template parameters

Thomas Kuehne thomas-dloop at kuehne.cn
Wed Nov 29 13:31:49 PST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail at puremagic.com schrieb am 2006-11-28:
> http://d.puremagic.com/issues/show_bug.cgi?id=617

> For regular function matching, an int argument can be automatically converted
> to a size_t.  But if IFTI is in play, then the difference between int and
> size_t in the function's parameter list causes IFTI to fail to find a match.
>
> -------
> import std.stdio : writefln;
>
> void simple_func(char[] s, size_t i)
> {
>     writefln(s, i);
> }
> void simple_func_t(T)(T s, size_t i)
> {
>     writefln(s, i);
> }
>
>
> void main(char[][] args)
> {
>     // ok as basic function
>     simple_func(args[0], 3);
>
>     // ok with explicit type
>     simple_func_t!(char[])(args[0], 3);
>
>     // ok with exact match on non-template param
>     simple_func_t!(char[])(args[0], 3u);
>
>     // Fails to to match with IFTI:
>     // "template template_deduction.simple_func_t(T) does not
>     //    match any template declaration
>     //  template template_deduction.simple_func_t(T) cannot 
>     //     deduce template function from argument types (char[],int)"
>     simple_func_t(args[0], 3);
> }

Added to DStress as
http://dstress.kuehne.cn/run/t/template_49_A.d
http://dstress.kuehne.cn/run/t/template_49_B.d
http://dstress.kuehne.cn/run/t/template_49_C.d

Thomas


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

iD8DBQFFbf+NLK5blCcjpWoRAsoKAJ4k/a8BP67hinQp3+Ae82LZEuIQsgCeKqwZ
/AJVkA45XnK8ddpPf1M0BPY=
=4yoq
-----END PGP SIGNATURE-----



More information about the Digitalmars-d-bugs mailing list