[Issue 14651] New: Typesafe variadic functions don't work after optional arguments
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Thu Jun  4 17:31:22 PDT 2015
    
    
  
https://issues.dlang.org/show_bug.cgi?id=14651
          Issue ID: 14651
           Summary: Typesafe variadic functions don't work after optional
                    arguments
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: erikas.aubade at gmail.com
DMD as of 2.067.1 will complain about missing a default value if you ask for a
typesafe variadic array after a parameter with a default value. (And it does
not allow you to set a default value on the variadic.)
Given that any variadic function may be called with no arguments in the
variadic section, it seems like this should be permitted after a default
argument. (And indeed, variadic functions with no type specifications seem to
work fine.)
example code:
//gives "Error: default argument expected for argv"
void func1 (size_t argc = 0, string[] argv...) {
}
import core.vararg;
//Does not issue an error.
void func2 (size_t argc = 0, ...) {
}
void main() {
}
--
    
    
More information about the Digitalmars-d-bugs
mailing list