Thread overview
[Issue 16206] traits getOverloads fails when one of the overload is a templatized function
Mar 10, 2018
Adam D. Ruppe
Apr 19, 2018
Simen Kjaeraas
May 15, 2020
Richard Manthorpe
May 15, 2020
Basile-z
May 15, 2020
Richard Manthorpe
May 15, 2020
Richard Manthorpe
Jan 03, 2021
Dlang Bot
March 10, 2018
https://issues.dlang.org/show_bug.cgi?id=16206

Adam D. Ruppe <destructionator@gmail.com> changed:

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

--- Comment #1 from Adam D. Ruppe <destructionator@gmail.com> ---
ah yes i just hit this too and was about to submit. same thing on module level

void foo()() {}
void foo(int) {}

void main() {
        foo(); // works
        foo(0); // also works so they seem to be overloaded...

        // yet this empty
        pragma(msg, __traits(getOverloads, mixin(__MODULE__), "foo"));

        // note: if you swap the order of the declarations above, it will
        // actually show one foo in the message
}

--
April 11, 2018
https://issues.dlang.org/show_bug.cgi?id=16206

johanengelen@weka.io changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |industry
                 CC|                            |johanengelen@weka.io

--
April 19, 2018
https://issues.dlang.org/show_bug.cgi?id=16206

Simen Kjaeraas <simen.kjaras@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras@gmail.com

--- Comment #2 from Simen Kjaeraas <simen.kjaras@gmail.com> ---
PR: https://github.com/dlang/dmd/pull/8195

--
May 30, 2018
https://issues.dlang.org/show_bug.cgi?id=16206

--- Comment #3 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/b52561fc497b70380c2ecd8ebd92cf11c31f0a36 Fix issue 16206 - getOverloads fails when first overload is template

https://github.com/dlang/dmd/commit/1ea020fcd22a8e1ee797328cba9f0c223dfba3bc Merge pull request #8195 from Biotronic/Issue16206

Fix Issue 16206 - traits getOverloads fails when one of the overload is a
templatized function
merged-on-behalf-of: unknown

--
May 30, 2018
https://issues.dlang.org/show_bug.cgi?id=16206

--- Comment #4 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dlang.org

https://github.com/dlang/dlang.org/commit/ee9cb9ba7c43a7401f222e0c1cb2063e0c35dd3b Fix Issue 16206 - traits getOverloads fails when one of the overload is a templatized function

https://github.com/dlang/dlang.org/commit/0e3bd088a9e06e0873ea861d299026231217f644 Merge pull request #2351 from Biotronic/Issue16206

Fix Issue 16206 - traits getOverloads fails when one of the overload is a
templatized function
merged-on-behalf-of: Mike Franklin <JinShil@users.noreply.github.com>

--
May 15, 2020
https://issues.dlang.org/show_bug.cgi?id=16206

Richard Manthorpe <rmanth@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |rmanth@gmail.com
         Resolution|FIXED                       |---

--- Comment #5 from Richard Manthorpe <rmanth@gmail.com> ---
This was never fixed - the bug is to do with the order in which the template and non-template overload are declared. If the template is declared last it is fine (as in the DMD tests), otherwise there is a problem.

--
May 15, 2020
https://issues.dlang.org/show_bug.cgi?id=16206

--- Comment #6 from Basile-z <b2.temp@gmx.com> ---
To prevent a breaking change a 3rd trait parameter was added. When you add an optional bool then templates are included, no matter the lexical order.

---
struct Foo
{
    void foo(A,Z)(A a, Z z){}
    void foo(float v){}
}

struct Bar
{
    void bar(float v){}
    void bar(A,Z)(A a, Z z){}
}

void main()
{
    static assert(__traits(getOverloads, Bar, "bar", true).length == 2);
    static assert(__traits(getOverloads, Foo, "foo", true).length == 2);
}
---

There are still overloads bugs, but when alias are used (https://issues.dlang.org/show_bug.cgi?id=20821). This is something else that has to do with the fact that once the alias template parameters are missing the lowering is difficual (declarations cant be lowered like expressions or statements).

In case I'm wrong on the status of 16206 please provide a new test case that justify the reopening.

--
May 15, 2020
https://issues.dlang.org/show_bug.cgi?id=16206

Richard Manthorpe <rmanth@gmail.com> changed:

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

--- Comment #7 from Richard Manthorpe <rmanth@gmail.com> ---
I was thinking about this: https://issues.dlang.org/show_bug.cgi?id=20821

But now I come to think of it, it is subtly different. I've re-marked it resolved.

--
May 15, 2020
https://issues.dlang.org/show_bug.cgi?id=16206

--- Comment #8 from Richard Manthorpe <rmanth@gmail.com> ---
Sorry, this: https://issues.dlang.org/show_bug.cgi?id=20833

--
January 03, 2021
https://issues.dlang.org/show_bug.cgi?id=16206

--- Comment #9 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #12093 "[dmd-cxx] Backport more recent traits to the C++ port" was merged into dmd-cxx:

- 2f4d3b7d3c9badd4f902343b18548aeda7f10197 by Biotronic:
  [dmd-cxx] Fix issue 16206 - getOverloads fails when first overload is
template

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

--