www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21366] New: `private` ignored for circular imports

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

          Issue ID: 21366
           Summary: `private` ignored for circular imports
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: andy.pj.hanson gmail.com

**app.d:**

```
import std.stdio : writeln;
import b : two;

void main() {
        writeln(two());
}

private int one() {
        return 1;
}
```

**b.d:**

```
module b;

import app : one;

int two() {
        return one() + one();
}
```

Module `b` should not be allowed to import `one`, but it compiles without
error. (Ran `dmd app.d b.d`.)

Tested with `dmd --version` of `DMD64 D Compiler v2.094.1`.

--
Nov 06 2020