Comment #1 by moonlightsentinel — 2021-04-07T03:20:02Z
Up to 2.065.0: Success with output:
-----
ubyte[]
char
-----
Comment #2 by dkorpel — 2021-04-07T08:49:57Z
This compilation output is correct.
https://dlang.org/spec/function.html#function-overloading
Both functions have match level 3: match with qualifier conversion.
That's because `in` makes the parameter `const`, so `ubyte[]` needs to be converted to `const(ubyte)[]`. Then partial ordering determines `const(ubyte)[16]` to be more specialized than `const(ubyte)[]`, so the fixed size version is chosen.
Comment #3 by temtaime — 2021-04-07T08:55:08Z
A slice is taken from argument, it is not original ubyte[16].
If i create temp variable à-la
auto tmp = arr[];
bar(tmp);
then correct overload is used
Note that using raw functions:
char bar(ubyte[] array);
int bar(ubyte[16] array);
is also a regression:
Up to 2.067.1: Success with output:
-----
ubyte[]
char
-----
Since 2.068.2: Success with output:
-----
ubyte[]
int
-----
Comment #6 by dlang-bot — 2021-04-10T23:26:59Z
dlang/dmd pull request #12399 "Fix Issue 21806 - Overload selection ignores slice" was merged into stable:
- 9dabb8f03cdb4e4acacd12449fc5558708e8746a by Boris Carvajal:
Fix Issue 21806 - Overload selection ignores slice
https://github.com/dlang/dmd/pull/12399
Comment #7 by dlang-bot — 2021-04-16T04:19:56Z
dlang/dmd pull request #12431 "merge stable" was merged into master:
- 5bba6357deac1ba8d5994ffeb5c526716e89a274 by Boris Carvajal:
Fix Issue 21806 - Overload selection ignores slice
https://github.com/dlang/dmd/pull/12431