Inspecting __traits(isDeprecated) and deprecation warnings

Boris Carvajal boris2.9 at gmail.com
Wed Sep 25 20:35:55 UTC 2019


On Wednesday, 25 September 2019 at 14:20:00 UTC, Anonymouse wrote:
> I added some deprecations in my project and am going through my 
> templates trying to silence the warnings that suddenly popped 
> up. This template works, but it triggers deprecation warnings 
> when I am actively trying to avoid them.

This code seems to work for classes too and even with DMD "-de" 
compiler switch.

template isMemberDeprecated(T, string name)
{
     enum isMemberDeprecated = mixin(q{__traits(isDeprecated, }, 
T, ".", name, q{)});
}

https://run.dlang.io/is/iQbxOC




More information about the Digitalmars-d-learn mailing list