Thread overview | |||||
---|---|---|---|---|---|
|
July 20, 2018 [Issue 19096] [REG 2.061] Proper error messages are not shown for templates that go beyond two deep, wrongly says no template overload matches | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19096 --- Comment #1 from Joakim <dbugz@joakim.fea.st> --- Ah, I finally figured out why, if I comment out the last constraint on toImpl, `is(typeof(parse!T(value)))`, I get the right error with `dmd -version=broken shadow.d`: frontend.d(12): Error: variable anydigits is shadowing variable frontend.parse!(real, string).parse.anydigits frontend.d(35): Error: template instance `frontend.parse!(real, string)` error instantiating frontend.d(42): instantiated from here: toImpl!(real, string) I'm unsure what that last constraint is supposed to accomplish, make sure parse() compiles and returns a type? It still used to print a useful error up till 2.060, but I'll leave it up to someone who knows the compiler better whether this should be considered a regression. -- |
October 10, 2018 [Issue 19096] [REG 2.061] Proper error messages are not shown for templates that go beyond two deep, wrongly says no template overload matches | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19096 Nicholas Wilson <iamthewilsonator@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |iamthewilsonator@hotmail.co | |m --- Comment #2 from Nicholas Wilson <iamthewilsonator@hotmail.com> --- The usage of is(typeof(parse!T(value))) follows a common pattern in phobos: namely to specify external dependencies of the function. (e.g. `all` has `is(typeof(unaryFun!pred(range.front))` in its constraint) toImpl uses parse and so specifies that in its constraint. This has the obvious effect of invalidating the template's candidacy which is needed because D doesn't do SFINAE. This is not a regression, just an unfortunate side effect of the above. On that note, my DIP[1] would make it immediately obvious that parse!T(value) is where the problem lies. [1]: https://github.com/dlang/DIPs/pull/131 -- |
February 23, 2021 [Issue 19096] [REG 2.061] Proper error messages are not shown for templates that go beyond two deep, wrongly says no template overload matches | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19096 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |razvan.nitu1305@gmail.com Resolution|--- |WORKSFORME --- Comment #3 from RazvanN <razvan.nitu1305@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. -- |
Copyright © 1999-2021 by the D Language Foundation