[Issue 18960] New: Function parameter requires name with default value

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 9 10:21:29 UTC 2018


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

--


More information about the Digitalmars-d-bugs mailing list