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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 28 07:52:41 PST 2006


http://d.puremagic.com/issues/show_bug.cgi?id=617

           Summary: IFTI doesn't use normal promotion rules for non-template
                    parameters
           Product: D
           Version: 0.175
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: wbaxter at gmail.com


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);
}


-- 




More information about the Digitalmars-d-bugs mailing list