[Issue 21917] New: Unused default values for IFTI parameters should not be typechecked against the IFTI-inferred type
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu May 13 05:04:45 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=21917
Issue ID: 21917
Summary: Unused default values for IFTI parameters should not
be typechecked against the IFTI-inferred type
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P3
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dlang-bugzilla at thecybershadow.net
This should work:
////////// test.d /////////
void fun(T)(T value = "hi")
{
}
void main()
{
fun(); // OK
fun("hello"); // OK
fun(42); // Error
}
///////////////////////////
The reason for why it should work is that e.g. we can't pass a range as a `fun`
argument. A workaround is to declare an overload, but that doesn't scale well
with the number of parameters.
--
More information about the Digitalmars-d-bugs
mailing list