Possible bug of "missing matching more than one candidate" in overload set
user1234
user1234 at 12.de
Fri Feb 13 16:06:54 UTC 2026
On Friday, 13 February 2026 at 15:12:16 UTC, monkyyy wrote:
> On Friday, 13 February 2026 at 14:56:43 UTC, user1234 wrote:
>> On Friday, 13 February 2026 at 14:54:44 UTC, monkyyy wrote:
>>> Template specialization rules can apply. I think its only a
>>> bug if the order of the declarations effect behavior(which
>>> they do often)
>>
>> No, order doesn't change which element of set is selected.
>
> Not my point, specialization overrides generic cases; an empty
> list is less generic then a vartatic one.
>
> ```d
> import std;
> void f(int i:0)(){"0".writeln;}
> void f(int i:3)(){"3".writeln;}
> void f(int i)(){"?".writeln;}
> unittest{
> static foreach(I;0..5){
> f!I;
> }}
> ```
>
> Id rather make different rules based off "first match", its a
> mess, but the rules are consistent.
ah... misunderstanding. I meant that if you declare the variadic
`f` before the "no param one", the "no param one" is still
selected, which illustrates that order of declaration is not part
of the game.
More information about the Digitalmars-d-learn
mailing list