[Issue 19096] [REG 2.061] Proper error messages are not shown for templates that go beyond two deep, wrongly says no template overload matches

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 23 13:25:07 UTC 2021


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305 at gmail.com
         Resolution|---                         |WORKSFORME

--- Comment #3 from RazvanN <razvan.nitu1305 at gmail.com> ---
Compiling this with git master yields:

onlineapp.d(42): Error: template onlineapp.toImpl cannot deduce function from
argument types !(real)(string), candidates are:
onlineapp.d(23):        toImpl(T, S)(S value)
  with T = real,
       S = string
  must satisfy the following constraint:
       is(typeof(parse!T(value)))

This is expected behavior from the compilers' point view. There is a constraint
that is not satisfied and that is exactly what the compiler is reporting; since
the constraint is an is expression, the errors are gagged and the shadowing is
not reported.

It could be argued that this is a phobos regression, however, as Nicholas
pointed out, the purpose of that check is to make sure that you are able to
instantiate `parse`, otherwise you might get errors from the innards of `parse`
that will leave most of the standard lib users scratching their head.On the
other hand, right now, things are very clear: you are not able to instantiate
the toImpl template because you are failing the is constraint. If you want to
find out more you can manually call it or compile with -verrors=spec. 

Closing as WORKSFORME.

--


More information about the Digitalmars-d-bugs mailing list