Thread overview
[Issue 23500] std.traits.getUDAs not working properly for overloads
Feb 16, 2023
Richard Cattermole
February 16, 2023
https://issues.dlang.org/show_bug.cgi?id=23500

Richard Cattermole <alphaglosined@gmail.com> changed:

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

--- Comment #1 from Richard Cattermole <alphaglosined@gmail.com> ---
This was rediscovered by a user on Discord.

The deprecation message wasn't very good.

/usr/include/dmd/phobos/std/traits.d(8514): Deprecation:
__traits(getAttributes) may only be used for individual functions, not overload
sets such as: __ctor

I modified the example here to demonstrate how to change their code:

```d
import std.traits;

void main() {
    enum attr1;
    enum attr2;

    struct A {
        @attr1
        void foo();
        @attr2
        void foo(int a);
    }

    static foreach(overload; __traits(getOverloads, A, "foo")) {
        pragma(msg, getUDAs!(overload, attr2));
    }
}
```

That deprecation message should be improved with more context, although perhaps there are some improvements that could be done more broadly like giving more context (i.e. what triggered that instantiation of getUDAs).

--
June 04, 2023
https://issues.dlang.org/show_bug.cgi?id=23500

johanengelen@weka.io changed:

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

--- Comment #2 from johanengelen@weka.io ---
Related bug https://issues.dlang.org/show_bug.cgi?id=23966

--
June 04, 2023
https://issues.dlang.org/show_bug.cgi?id=23500

--- Comment #3 from johanengelen@weka.io ---
Failing testcase with templates:

```
module test;
import std.traits;
@("gigi")
void fun() {}
@("mimi")
void fun(int) {}
void fun()(int, ulong) {}

void main()
{
    static foreach (t; __traits(getOverloads, test, "fun"))
        pragma(msg, hasUDA!(t, "gigi"));
}
```

--
December 01
https://issues.dlang.org/show_bug.cgi?id=23500

--- Comment #4 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/9851

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--