www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13484] New: Template type deduction from delegate parameter

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

          Issue ID: 13484
           Summary: Template type deduction from delegate parameter fails
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: weltensturm gmail.com

When overloading a template function taking a delegate with type T with one
lacking arguments, type deduction fails:
test.d(10): Error: template test.test cannot deduce function from argument
types !()(void function(float _param_0) pure nothrow  nogc  safe), candidates
are:
test.d(2):        test.test()(void delegate() hi)
test.d(5):        test.test(T)(void delegate(T) hi)
Minimal example:

void test()(void delegate() hi){
}

void test(T)(void delegate(T) hi){
}

void main(){
        test({}); // works
        test((float){}); // throws error
}

Expected:
No error, correct deduction

DMD version:
DMD64 D Compiler v2.066

--
Sep 16 2014