Bug 14875 – A template instance with deprecated symbol/type needlessly repeats "Deprecation:" messages

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-08-06T09:47:00Z
Last change time
2017-07-22T12:36:23Z
Keywords
diagnostic, pull
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2015-08-06T09:47:32Z
Example code: deprecated class Dep { } alias X = Foo!Dep; // Line 3 template Foo(T) { pragma(msg, T); // Line 7 enum Foo = cast(void*)Bar!T; } template Bar(T) { pragma(msg, T); // Line 12 enum Bar = &Baz!T; } template Baz(T) { pragma(msg, T); // Line 18 immutable Baz = 1234; } Output: test.d(3): Deprecation: class test.Dep is deprecated test.d(7): Deprecation: class test.Dep is deprecated Dep test.d(12): Deprecation: class test.Dep is deprecated Dep test.d(18): Deprecation: class test.Dep is deprecated Dep Dep Current compiler reports the message at the every use of deprecated symbols. However, if a deprecated symbol/type comes from template parameter, the report for that is already done at the instantiation point. The rest is just redundant. So, I think output of the example code should be changed to: test.d(3): Deprecation: class test.Dep is deprecated Dep Dep Dep Dep
Comment #1 by k.hara.pg — 2015-08-06T11:07:48Z
Comment #2 by github-bugzilla — 2015-08-08T05:43:48Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/f07f0909f8e5ed90381e149bb71e13aa2f560279 fix Issue 14875 - A template instance with deprecated symbol/type needlessly repeats "Deprecation:" messages https://github.com/D-Programming-Language/dmd/commit/9c8a2604da7c643bdb95c4ca7566694d7e8de370 Merge pull request #4865 from 9rnsr/fix_deprecation Issue 14875 & 14876 - improve deprecation message diagnostic
Comment #3 by github-bugzilla — 2017-07-22T12:36:23Z
Commits pushed to dmd-cxx at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/f07f0909f8e5ed90381e149bb71e13aa2f560279 fix Issue 14875 - A template instance with deprecated symbol/type needlessly repeats "Deprecation:" messages https://github.com/dlang/dmd/commit/9c8a2604da7c643bdb95c4ca7566694d7e8de370 Merge pull request #4865 from 9rnsr/fix_deprecation