[Issue 13484] New: Template type deduction from delegate parameter fails

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Sep 16 09:26:08 PDT 2014


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 at puremagic.com
          Reporter: weltensturm at 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

--


More information about the Digitalmars-d-bugs mailing list