Bug 24437 – Optional arguments changing overload preference when compared to a varatic function

Status
NEW
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2024-03-14T22:15:47Z
Last change time
2024-12-13T19:33:49Z
Assigned to
No Owner
Creator
crazymonkyyy
Moved to GitHub: dmd#20416 →

Comments

Comment #0 by crazymonkyyy — 2024-03-14T22:15:47Z
```d import std; auto notfoo(T)(T[] args...){ "wrong function 1".writeln; } auto notfoo(T,S)(T[S] args){ "right function 1".writeln; } auto notfoo2(T)(T[] args...){ "wrong function 2".writeln; } auto notfoo2(T,S)(T[S] args,int i=1000){ "right function 2".writeln; } void main(){ [1:'a',2:'b',3:'c'].notfoo; "---".writeln; [1:'a',2:'b',3:'c'].notfoo2; } ``` right function 1 --- wrong function 2 https://dlang.org/spec/function.html#function-overloading > 7. A function with a variadic argument is considered less specialized than a function without.
Comment #1 by robert.schadek — 2024-12-13T19:33:49Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20416 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB