module test;
struct A
{
int foo() { return 1; }
alias bar1 = foo;
deprecated("please use foo")
alias bar3 = foo;
}
deprecated("No longer support")
struct B
{
}
pragma(msg, __traits(allMembers, A));
pragma(msg, __traits(isDeprecated, A, "foo")));
pragma(msg, __traits(isDeprecated, __traits(getMember, A, "bar3")));
pragma(msg, __traits(isDeprecated, B));
Output
AliasSeq!("foo", "bar1", "bar3")
false
false -> should be true
true
Should support checking on member
pragma(msg, __traits(isDeprecated, A.bar3));
Comment #1 by nick — 2024-06-17T09:52:24Z
> pragma(msg, __traits(isDeprecated, A, "foo")));
The docs say it takes only one argument (like other trait docs), though actually the result is true if both A and "foo" are deprecated.
https://dlang.org/spec/traits.html#isDeprecated
> Should support checking on member
> pragma(msg, __traits(isDeprecated, A.bar3));
That is actually the correct syntax, but the result is false when it should be true.
(I am adding a member symbol example in this pull https://github.com/dlang/dlang.org/pull/3851).
Comment #2 by robert.schadek — 2024-12-13T19:35:41Z