[Issue 10437] Warnings for unused private imports

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 21 06:30:38 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10437



--- Comment #3 from qznc at web.de 2013-06-21 06:30:37 PDT ---
(In reply to comment #1)
> What will occur with template function?
> 
> import std.conv : to;
> 
> T convert(T, S)(S src)
> {
>     return to!T(src);
> }
> 
> void main() {}
> // template function convert is not instantiated.
> 
> In this case, imported std.conv is unused then compiler might warn it. Is this
> right?

I think the question is misleading. The actual question is how clever the
analysis is. Call-graph information provides a similar scenario:

import std.stdio;

void foo() {
    writeln("foo");
}

void main () {}
// foo is never called

In such scenarios, deleting a statement might declare a whole chain (actually
DAG) of (template or normal) functions unused. It is a question of taste, if
the user should be flooded with warnings in this case.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list