Bug 13462 – Renamed imported module can be accessed by FQN when other import is present

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2014-09-12T08:08:11Z
Last change time
2019-05-05T15:11:42Z
Assigned to
No Owner
Creator
Oliver Mangold

Comments

Comment #0 by ybyt4t — 2014-09-12T08:08:11Z
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.
Comment #1 by dkorpel — 2019-05-05T15:11:42Z
Starting at DMD 2.071.2 this gives a deprecation warning and since 2.084.0 it is an error. It seems to be caused by fully qualified names bypassing private imports, which has been fixed. (https://dlang.org/changelog/2.084.0.html#fqn_imports_bypass_private_imports_error) *** This issue has been marked as a duplicate of issue 313 ***