There is currently no way to test whether a particular symbol is deprecated. This isn't commonly needed, but it can matter when doing introspection on all of the symbols within a module or class and generating code based on the list of symbols, since skipping deprecated symbols in those cases would be required to avoid creating deprecation warnings, and if someone actually used -de, then the code could not compile because of the inadvertent use of deprecated symbols, and there would be no way to avoid using those deprecated symbols, since there's currently no way to introspect whether a symbol is deprecated or not.
functionAttributes could be improved to include deprecated, but that would only cover functions, and just about any symbol can be deprecated, so I would suggest simply adding a new trait to do the test. e.g. __traits(isDeprecated, symbol).
Comment #1 by petar.p.kirov — 2017-08-29T09:19:14Z
Ditto for @future.
Comment #2 by github-bugzilla — 2017-10-05T16:12:07Z
dlang/dmd pull request #12093 "[dmd-cxx] Backport more recent traits to the C++ port" was merged into dmd-cxx:
- 349f960f54688b70a38f3e40bd2df5b67f5dbafc by dunkyp:
[dmd-cxx] fix issue 17791 - add __traits(deprecated, symbol)
https://github.com/dlang/dmd/pull/12093