[Issue 21338] Confusing error message for template overload resolution failure

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 31 15:38:38 UTC 2022


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

Nick Treleaven <nick at geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick at geany.org

--- Comment #5 from Nick Treleaven <nick at geany.org> ---
With https://github.com/dlang/dmd/pull/14606 too, the error will be:

splitoverload.d(7): Error: no overload matches for `split("Learning D is fun")`
splitoverload.d(7):        Candidates are:
std\regex\package.d(1695):        split(String, RegEx)(String input, RegEx rx)
if (isSomeString!String && isRegexFor!(RegEx, String))
std\array.d(1924):        split(S)(S s) if (isSomeString!S)
std\array.d(2030):        split(Range, Separator)(Range range, Separator sep)
if (isForwardRange!Range && (is(typeof(ElementType!Range.init ==
Separator.init)) || is(typeof(ElementType!Range.init ==
ElementType!Separator.init)) && isForwardRange!Separator))
std\array.d(2040):        split(alias isTerminator, Range)(Range range) if
(isForwardRange!Range && is(typeof(unaryFun!isTerminator(range.front))))

At least now the user may try disambiguating `split` and then they will see the
constraint failure message for the isTerminator overload. It is still confusing
why that fails, but they may then try calling `isWhite(' ')` manually and see
the (existing) error message:

splitoverload.d(13): Error: function `std.ascii.isWhite` at
C:\D\dmd2\windows\bin\..\..\src\phobos\std\ascii.d(411) conflicts with function
`std.uni.isWhite` at
C:\D\dmd2\windows\bin\..\..\src\phobos\std\uni\package.d(8907)

--


More information about the Digitalmars-d-bugs mailing list