Bug 23822 – Deprecated struct alias ignored completely
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2023-04-05T04:55:51Z
Last change time
2023-06-02T11:28:48Z
Keywords
accepts-invalid, industry, pull
Assigned to
No Owner
Creator
FeepingCreature
Comments
Comment #0 by default_357-line — 2023-04-05T04:55:51Z
Consider this code:
```
alias Alias(alias A) = A;
deprecated alias value = Alias!5;
void main() { auto a = value; }
```
This correctly errors with Deprecation: alias `onlineapp.value` is deprecated
However, this code:
```
alias Alias(alias A) = A;
struct S { deprecated alias value = Alias!5; }
void main() { auto a = S.value; }
```
gives no warning at all and compiles with `-de`.
(enum works)
Comment #1 by default_357-line — 2023-04-05T04:58:18Z
```
alias Alias(alias A) = A;
class S { deprecated alias value = Alias!5; }
void main() { auto a = S.value; }
```
This errors correctly.
Comment #2 by dlang-bot — 2023-04-05T05:59:21Z
@FeepingCreature created dlang/dmd pull request #15077 "Fix issue 23822: Check for deprecation before resolving alias on struct type member access." fixing this issue:
- Fix issue 23822: Check for deprecation before resolving alias on struct type member access.
https://github.com/dlang/dmd/pull/15077
Comment #3 by dlang-bot — 2023-04-05T09:35:33Z
dlang/dmd pull request #15077 "Fix issue 23822: Check for deprecation before resolving alias on struct type member access." was merged into master:
- a40e04d78c13d3f90219e2b9260beaeb61c6e24b by Mathis Beer:
Fix issue 23822: Check for deprecation before resolving alias on struct type member access.
https://github.com/dlang/dmd/pull/15077
Comment #4 by default_357-line — 2023-06-02T11:28:48Z
*** Issue 23954 has been marked as a duplicate of this issue. ***