[Issue 23966] [REG2.102] Cannot use traits(getAttributes) with overloaded template
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jun 13 13:59:27 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=23966
--- Comment #3 from RazvanN <razvan.nitu1305 at gmail.com> ---
(In reply to RazvanN from comment #2)
> This is not a problem with the deprecation of __traits(getAttributes), but
> rather a problem of traits(getOverloads). This was simply exposed by the
> deprecation. If you use __traits(getLocation) instead of getAttributes, you
> will get the same behavior (except that an error is issued, not a
> deprecation):
>
> module test;
>
> @("gigi")
> void fun() {}
> @("mimi")
> void fun(int) {}
> @("didi")
> void fun()(int, ulong) {}
>
> void main()
> {
> //pragma(msg, __traits(getAttributes, fun));
> pragma(msg, __traits(getOverloads, test, "fun"));
> static foreach (t; __traits(getOverloads, test, "fun"))
> pragma(msg, __traits(getLocation, t));
>
> }
Updated snippet, without comments and extra things:
module test;
@("gigi")
void fun() {}
@("mimi")
void fun(int) {}
@("didi")
void fun()(int, ulong) {}
void main()
{
static foreach (t; __traits(getOverloads, test, "fun"))
pragma(msg, __traits(getLocation, t));
}
--
More information about the Digitalmars-d-bugs
mailing list