www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20729] New: Circular import causes "not visible" error

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

          Issue ID: 20729
           Summary: Circular import causes "not visible" error
           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**:

```
module app;

import core.stdc.math : fabs;

import b : b;

void fabs(const string s) {
}

void main() {
}
```

**b.d**:

```
module b;

import app : fabs;

void b() {
        fabs("");
}
```

Compile with `dmd app.d`.
There should be no compile errors. Instead there is:
```
b.d(3): Error: module app member fabs is not visible from module b
```

There is no such error is you remove the `fabs` import in `app.d` or you move
the import in `b.d` into `void b`.

There is also no such error if you compile using `dmd b.d app.d` instead.

--
Apr 11