Bug 17211 – deprecated is not consistently allowed on local declarations

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-02-20T19:16:20Z
Last change time
2024-12-13T18:51:42Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Jonathan M Davis
Moved to GitHub: dmd#19236 →

Comments

Comment #0 by issues.dlang — 2017-02-20T19:16:20Z
When deprecated is and isn't allowed on local declarations is not consistent. compiles: void main() { deprecated class Foo { } } void main() { deprecated void foo() { } } void main() { deprecated int i; } does not compile: void main() { deprecated("Deprecated in Qt version 5.3") class Foo { } } void main() { deprecated("Deprecated in Qt version 5.3") void foo() { } } void main() { deprecated("Deprecated in Qt version 5.3") int i; } void main() { deprecated enum Enum { a, b, c, d, } } void main() { deprecated("Deprecated in Qt version 5.3") enum Enum { a, b, c, d, } } The fix for issue #11689 fixed at least some of the cases where deprecated didn't work on local symbols, but either it didn't fix them all, or a change since then broke some of them. In particular, deprecated on local enum declarations doesn't work, and having a deprecation message on local declarations never works. Personally, I find this very annoying, because I'm trying to test code generation by mixing the generated code into a unittest block, and that doesn't consistently work right now if the local declaration is deprecated.
Comment #1 by andrei — 2017-06-06T21:13:27Z
*** Issue 17471 has been marked as a duplicate of this issue. ***
Comment #2 by robert.schadek — 2024-12-13T18:51:42Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19236 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB