Thread overview
[Issue 15225] cannot overload directly aliased function literals
Oct 27, 2015
Vladimir Panteleev
Jul 03, 2017
Vladimir Panteleev
Feb 25, 2018
ag0aep6g@gmail.com
Apr 22, 2019
Basile-z
Mar 21, 2020
Basile-z
Dec 21, 2020
Dlang Bot
Dec 21, 2020
Dlang Bot
October 27, 2015
https://issues.dlang.org/show_bug.cgi?id=15225

Vladimir Panteleev <thecybershadow@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow@gmail.com

--- Comment #1 from Vladimir Panteleev <thecybershadow@gmail.com> ---
(In reply to Kenji Hara from comment #0)
> alias foo = (int x) => x;
> alias foo = (string x) => x;

This syntax doesn't work in released DMD versions, but if I replace it with:

alias I(alias X) = X;
alias foo = I!((int x) => x);
alias foo = I!((string x) => x);

then compilation succeeds (though then I get a linker error).

--
July 03, 2017
https://issues.dlang.org/show_bug.cgi?id=15225

--- Comment #2 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
(In reply to Vladimir Panteleev from comment #1)
> then compilation succeeds (though then I get a linker error).

Linking succeeds since 2.071.0 (fixed by https://github.com/dlang/dmd/pull/5523). Kenji's example still doesn't compile.

--
February 25, 2018
https://issues.dlang.org/show_bug.cgi?id=15225

ag0aep6g@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxsamukha@gmail.com

--- Comment #3 from ag0aep6g@gmail.com ---
*** Issue 16099 has been marked as a duplicate of this issue. ***

--
April 22, 2019
https://issues.dlang.org/show_bug.cgi?id=15225

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b2.temp@gmx.com

--- Comment #4 from Basile-z <b2.temp@gmx.com> ---
A second level of aliasing is required:

    alias lambda1 = (int x) => x;
    alias lambda2 = (string x) => x;
    alias lambda = lambda1;
    alias lambda = lambda2;

    void main()
    {
        auto r0 = lambda(1);
        auto r1 = lambda("a");
    }

But this should not be the case since, as found in one of the duplicated reports, this works fine if you replace lambda1/lambda2 by standard functions.

It turns out that the problem is that when doing aliasSemantic() for lambda1, its `.overnext` member is null. so without the second level of aliasing, the first match is always used.

It's quite possible that the semantic is done in the wrong order., e.g the call is resolved before that the overload set is built.

--
March 21, 2020
https://issues.dlang.org/show_bug.cgi?id=15225

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|b2.temp@gmx.com             |

--
December 21, 2020
https://issues.dlang.org/show_bug.cgi?id=15225

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

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

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
@BorisCarvajal created dlang/dmd pull request #12041 "Fix Issue 15225 - cannot overload directly aliased function literals" fixing this issue:

- Fix Issue 15225 - cannot overload directly aliased function literals

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

--
December 21, 2020
https://issues.dlang.org/show_bug.cgi?id=15225

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

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

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #12041 "Fix Issue 15225 - cannot overload directly aliased function literals" was merged into master:

- f04ab2275a948b3b4ea858523b326db971201eb4 by Boris Carvajal:
  Fix Issue 15225 - cannot overload directly aliased function literals

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

--