[Issue 15086] import doesn't verify module declaration

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 26 06:24:48 UTC 2018


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

Timothee Cour <timothee.cour2 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timothee.cour2 at gmail.com
           Hardware|x86_64                      |All
                 OS|Linux                       |All
           Severity|minor                       |critical

--- Comment #2 from Timothee Cour <timothee.cour2 at gmail.com> ---
just ran into this again, this is a serious hole in the D module system.

Here was the example i was gonna report:


```dmd -I. main.d
main
bar // BUG! was imported as foo.bar (inconsistent)
foo.bar2
asdf.wrong // BUG! was imported as foo.bar (inconsistent)
```

```pragma(msg, __MODULE__);
import foo.bar;
import foo.bar2;
import foo.bar3;
void main(){}

cat foo/bar.d
pragma(msg, __MODULE__);
cat foo/bar2.d

cat foo/bar2.d
module foo.bar2;
pragma(msg, __MODULE__);

cat foo/bar3.d
module asdf.wrong;
pragma(msg, __MODULE__);
```



LINKS:
https://github.com/dlang/dmd/pull/7778 Bug fix: dmd allows importing modules
with wrong name #7778

--


More information about the Digitalmars-d-bugs mailing list