www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13694] New: Typesafe variadic function template overload

https://issues.dlang.org/show_bug.cgi?id=13694

          Issue ID: 13694
           Summary: Typesafe variadic function template overload fails to
                    match to any template
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: alanb ucora.com

Below minimal code used to work with DMD 2.064.2 amd64 
fails with DMD 2.066.1 amd64

struct S{}

void foo(T)( string A, long E, T[] G ... )
{}

void foo(T)( string A, T[] G ... )
{}

int main()
{
   S v;
   foo("A", v); // <- OK
   foo("A", 0, v); // <- used to be OK but now fails
   foo!(S)("A", 0, v); // <- workaround solution
   return 0;
}

$ dmd main.d
main.d(13): Error: template main.foo cannot deduce function from argument types
!()(string, int, S), candidates are:
main.d(3):        main.foo(T)(string A, long E, T[] G...)
main.d(6):        main.foo(T)(string A, T[] G...)

--
Nov 06 2014