[Issue 16484] regression(2.064) Overloaded empty funcs trigger AssertError: "Called `get' on null Nullable"
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Oct 13 16:48:39 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16484
Walter Bright <bugzilla at digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |bugzilla at digitalmars.com
Resolution|--- |WONTFIX
--- Comment #3 from Walter Bright <bugzilla at 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.
--
More information about the Digitalmars-d-bugs
mailing list