[Issue 13462] New: Renamed imported module can be accessed by FQN when other import is present

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Sep 12 01:08:11 PDT 2014


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

          Issue ID: 13462
           Summary: Renamed imported module can be accessed by FQN when
                    other import is present
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: ybyt4t at gmail.com

When I try to compile the following program:

---
module main;

import io = std.stdio;

void main(string[] args)
{
    std.stdio.writeln("Hello World!");
}
---

I get an error 'undefined identifier std'. I understand this is the expected
behavior, as with a renamed import as used here, access to the module is only
possible via the rename 'io'. But when add one more non-renamed import, as in

---
module main;

import io = std.stdio;
import std.string;

void main(string[] args)
{
    std.stdio.writeln("Hello World!");
}
---

the compilation works. This seems to be wrong to me.

--


More information about the Digitalmars-d-bugs mailing list