www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12735] New: imports via mixin template become public imports

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

          Issue ID: 12735
           Summary: imports via mixin template become public imports
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: 2krnk gmx.net

if module demo_i has an import declaration via mixin template it automatically
becomes a public import (that can be seen/used in all modules importing
demo_i).

(only tested with DMD 2.064.2)
----
module demo_i;

mixin template imp(){
    import std.algorithm;
}
mixin imp!();
----
----
module demo;

import std.stdio;
import demo_i;

enum teststr = "This should not work!";

void main(string[] args)
{
    writeln( canFind(teststr,"not") );  // works & prints "true"!
}
----

--
May 11 2014