Thread overview
[Issue 21806] Overload selection ignores slice
Apr 07, 2021
Dennis
Apr 07, 2021
Temtaime
Apr 07, 2021
Dlang Bot
Apr 07, 2021
Boris Carvajal
Apr 10, 2021
Dlang Bot
Apr 16, 2021
Dlang Bot
April 07, 2021
https://issues.dlang.org/show_bug.cgi?id=21806

hsteoh@quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh@quickfur.ath.cx

--
April 07, 2021
https://issues.dlang.org/show_bug.cgi?id=21806

moonlightsentinel@disroot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |moonlightsentinel@disroot.o
                   |                            |rg
           Severity|critical                    |regression

--- Comment #1 from moonlightsentinel@disroot.org ---
Up to      2.065.0: Success with output:
-----
ubyte[]
char
-----

--
April 07, 2021
https://issues.dlang.org/show_bug.cgi?id=21806

Dennis <dkorpel@live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dkorpel@live.nl
         Resolution|---                         |INVALID

--- Comment #2 from Dennis <dkorpel@live.nl> ---
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.

--
April 07, 2021
https://issues.dlang.org/show_bug.cgi?id=21806

Temtaime <temtaime@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #3 from Temtaime <temtaime@gmail.com> ---
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

--
April 07, 2021
https://issues.dlang.org/show_bug.cgi?id=21806

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@BorisCarvajal created dlang/dmd pull request #12399 "Fix Issue 21806 - Overload selection ignores slice" fixing this issue:

- Fix Issue 21806 - Overload selection ignores slice

https://github.com/dlang/dmd/pull/12399

--
April 07, 2021
https://issues.dlang.org/show_bug.cgi?id=21806

Boris Carvajal <boris2.9@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |boris2.9@gmail.com

--- Comment #5 from Boris Carvajal <boris2.9@gmail.com> ---
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
-----

--
April 10, 2021
https://issues.dlang.org/show_bug.cgi?id=21806

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
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

--
April 16, 2021
https://issues.dlang.org/show_bug.cgi?id=21806

--- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> ---
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

--