[Issue 24831] New: IFTI fails for a function template with a default function argument
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Oct 24 07:01:34 UTC 2024
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 at puremagic.com
Reporter: maxsamukha at 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.
--
More information about the Digitalmars-d-bugs
mailing list