[Issue 21917] 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
Wed Oct 23 15:56:49 UTC 2024


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

--- Comment #10 from Max Samukha <maxsamukha at gmail.com> ---
(In reply to Max Samukha from comment #9)
> All seems good.

Unfortunately, no. This compiles ok:

void foo(T = int)(T a = T.init)
{
}

void main()
{
    foo();
    foo("x");
}


But if there's another template parameter, the compiler tries to reuse the
previous instantiation and fails:

void foo(U, T = int)(T a = T.init)
{
}

void main()
{
    foo!bool(0);
    foo!bool("x");
}

Is this a bug?

--


More information about the Digitalmars-d-bugs mailing list