[Issue 20300] New: memoize doesn't work with default params

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 14 15:51:05 UTC 2019


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

          Issue ID: 20300
           Summary: memoize doesn't work with default params
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: trikkuz at gmail.com

import std;

int test(int a = 0) { return a; }

alias cached = memoize!test;

void main()
{ 
    cached(0); // Works;
    cached(1); // Works;
    cached();  // Error
}


Error: function std.functional.memoize!(test).memoize(int _param_0) is not
callable using argument types ()
onlineapp.d(11):        missing argument for parameter #1: int _param_0

--


More information about the Digitalmars-d-bugs mailing list