D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 17791 - Add __traits(isDeprecated, ...)
Summary: Add __traits(isDeprecated, ...)
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-28 21:29 UTC by Jonathan M Davis
Modified: 2021-01-03 22:57 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jonathan M Davis 2017-08-28 21:29:15 UTC
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 ZombineDev 2017-08-29 09:19:14 UTC
Ditto for @future.
Comment 2 github-bugzilla 2017-10-05 16:12:07 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/9e131398d7f8c7a296fecda942f77c336c7bd611
fix issue 17791 - add __traits(deprecated, symbol)

https://github.com/dlang/dmd/commit/70d909eea541d528bb4835bef30db8a7d889ed1b
Merge pull request #7178 from dunkyp/master

fix issue 17791 - add __traits(deprecated, symbol)
Comment 3 Seb 2017-10-05 18:09:33 UTC
> Ditto for @future

https://issues.dlang.org/show_bug.cgi?id=17878
Comment 4 Dlang Bot 2021-01-03 22:57:12 UTC
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