Bug 21176 – deprecation inside template should show the instance loc as errorSupplemental
Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-08-18T22:51:05Z
Last change time
2020-10-11T08:27:59Z
Keywords
diagnostic
Assigned to
No Owner
Creator
Basile-z
Comments
Comment #0 by b2.temp — 2020-08-18T22:51:05Z
https://forum.dlang.org/post/[email protected]
---
void foo(T)()
{
alias F = ref int;
}
void main()
{
foo!int;
}
---
outputs:
> /tmp/temp_7F8F0E944DF0.d(3,22): Deprecation: storage class `ref` has no effect in type aliases
the ER is to have also this one:
> /tmp/temp_7F8F0E944DF0.d(8,5): instanciated from here
or, when the caller is not a template
> /tmp/temp_7F8F0E944DF0.d(8,5): called from here
Comment #1 by razvan.nitu1305 — 2020-09-18T09:36:23Z
I cannot reproduce this issue on run.dlang.io. However, I get what you mean:
deprecated int a;
void foo(T)()
{
alias F = a;
}
void main()
{
foo!int;
}
If it's an error it does show the stack trace, however I am not convinced that that should also be the case for deprecations.
Comment #2 by b2.temp — 2020-09-30T18:21:11Z
`deprecated` is sometimes used to refactorize. In this case it's essential to have the instantation sites as additional diagnostic.
Comment #3 by boris2.9 — 2020-09-30T22:48:09Z
The required info is printed if you use "dmd -de" [1], but the more natural way to implement this is to add an option to the "-dw" switch like -dw=context.
[1]:
onlineapp.d(6): Deprecation: variable onlineapp.a is deprecated
onlineapp.d(11): Error: template instance onlineapp.foo!int error instantiating
Comment #4 by b2.temp — 2020-10-11T08:27:59Z
*** This issue has been marked as a duplicate of issue 20916 ***