[Issue 16059] needed better error messages for failed overloads
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Nov 9 14:33:15 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=16059
RazvanN <razvan.nitu1305 at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |razvan.nitu1305 at gmail.com
Resolution|--- |WORKSFORME
--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
Errors have been improved since then and you also get to see which part of the
constraint failed. I would consider that this is a satisfactory development
since this bug report was filed.
Sample:
void fun(T)(T)
if (is(T == int) || is(T == string))
{}
void fun(T)(T)
if (is(T == float))
{}
struct A {}
void main()
{
fun!A(A());
}
yields:
onlineapp.d(13): Error: none of the overloads of template `onlineapp.fun` are
callable using argument types `!(A)(A)`
onlineapp.d(1): Candidates are: `fun(T)(T)`
with `T = A`
must satisfy one of the following constraints:
` is(T == int)
is(T == string)`
onlineapp.d(5): `fun(T)(T)`
with `T = A`
must satisfy the following constraint:
` is(T == float)`
This tells you exactly what failed.
--
More information about the Digitalmars-d-bugs
mailing list