www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18960] New: Function parameter requires name with default value

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

          Issue ID: 18960
           Summary: Function parameter requires name with default value
           Product: D
           Version: D2
          Hardware: x86
                OS: All
            Status: NEW
          Severity: trivial
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: alphaglosined gmail.com

As per spec this should not be possible.

void main() {
    Foo foo = &bar;
    foo();
}

alias Foo = void function(int=6);

void bar(int v = 6) {
    import std.stdio;
    writefln("%i", v);   
}

A simple error check can be added here:
https://github.com/dlang/dmd/blob/master/src/dmd/parse.d#L2860

--
Jun 09 2018