[Issue 16345] New: lazy variadic function in template with default value cannot be deduced
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Mon Aug  1 02:12:44 PDT 2016
    
    
  
https://issues.dlang.org/show_bug.cgi?id=16345
          Issue ID: 16345
           Summary: lazy variadic function in template with default value
                    cannot be deduced
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: kroeplin.d at googlemail.com
The following code does not compile:
void all(string file = __FILE__, size_t line = __LINE__)(void delegate()[] dgs
...)
{
    foreach (dg; dgs)
    {
        dg();
    }
}
void main()
{
    all(
        assert(true),
    );
}
Error: template all cannot deduce function from argument types !()(void),
candidates are:
       all(string file = __FILE__, ulong line = __LINE__)(void delegate()[]
dgs...)
Workaround: call `all!()(...)` instead of `all(...)`.
--
    
    
More information about the Digitalmars-d-bugs
mailing list