[Issue 22119] New: [Functions] Function Overloading clarity for int[] and strings
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 12 18:15:40 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22119
Issue ID: 22119
Summary: [Functions] Function Overloading clarity for int[] and
strings
Product: D
Version: D2
Hardware: All
URL: http://dlang.org/
OS: All
Status: NEW
Severity: enhancement
Priority: P3
Component: dlang.org
Assignee: nobody at puremagic.com
Reporter: crazymonkyyy at gmail.com
Created attachment 1824
--> https://issues.dlang.org/attachment.cgi?id=1824&action=edit
code with confususion, line 50
import std;
struct bar{
int i;
}
struct foo{
bar i; alias i this;
}
void foobar(bar[] yo){
//void foobar(T:bar[])(T yo){
"bar[]".writeln;
}
void foobar(T:foo)(T[3] t){
"foo[3]".writeln;}
unittest{
foobar([foo(),foo(),foo()]);
}
---
I would suggest throwing in a note that says something like "int[3] matches to
string before T[3] this can be fixed by redefining string function to
'(T:string)(T s)'"
--
More information about the Digitalmars-d-bugs
mailing list