www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14875] New: A template instance with deprecated symbol/type

https://issues.dlang.org/show_bug.cgi?id=14875

          Issue ID: 14875
           Summary: A template instance with deprecated symbol/type
                    needlessly repeats "Deprecation:" messages
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

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

--
Aug 06 2015