[Issue 9626] More precise error message in some cases when failed template constraint

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Apr 22 05:18:03 PDT 2016


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

--- Comment #2 from Sobirari Muhomori <dfj1esp02 at sneakemail.com> ---
void f(int n, T)(T val)if(n==0){}
void f1(int n)(int val)if(n==0){}
void g()
{
    f!1(1);
    f1!1(1);
}

The second instatiation gives good error message: "Error: template instance
f1!1 does not match template declaration f1(int n)(int val) if (n == 0)".

The first instatiation gives less helpful error message: "Error: template f
cannot deduce function from argument types !(1)(int), candidates are:...", but
it doesn't look like there's problem with deduction, should report no match.

See https://forum.dlang.org/post/gvzgecxrhdxrqchekijz@forum.dlang.org

--


More information about the Digitalmars-d-bugs mailing list