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

Walter Bright <bugzi...@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzi...@digitalmars.com
         Resolution|---                         |WONTFIX

--- Comment #3 from Walter Bright <bugzi...@digitalmars.com> ---
(In reply to ag0aep6g from comment #2)
> void foo(T)(Nullable!T value) {}

Considered:
    "match with conversion for initial template arguments"
    "exact match for inferred template arguments"

> void foo()(int i) { assert(false); /* hit */ }

Considered:
   "exact match for initial template arguments"
   "exact match for inferred template arguments"

And so the second match is better. The relevant line in the source code is
"matchTiargs = MATCHconvert;" at:

    https://github.com/dlang/dmd/blob/master/src/dtemplate.d#L1916

This is because the parameter 'T' is deduced from argument 'Nullable!int',
rather than being supplied directly.

Whether this is correct or not is debatable, I think the template rules are
excessively complex, but they are the result of constant complaints and
revision. I am extremely reluctant to change them further, because that will
inevitably result in hard-to-explain breakage, like this one, which was
apparently introduced in 2.064. If someone wants to find the specific PR that
did it, I'd appreciate it.

--

Reply via email to