October 24 [Issue 24831] New: IFTI fails for a function template with a default function argument | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24831 Issue ID: 24831 Summary: IFTI fails for a function template with a default function argument Product: D Version: D2 Hardware: x86_64 OS: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: maxsamukha@gmail.com This renders default arguments in generic functions unusable. void foo(U, T = int)(T v = T.init) { } void main() { foo!int(); // ok foo!int("x"); // fail } Error: function `foo` is not callable using argument types `(string)` The second call tries to reuse the previous instantiation instead of creating a new one. An explicit instantiation works but defeats the purpose of using default arguments. -- |
Copyright © 1999-2021 by the D Language Foundation