D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 8636 - inconsistent behavior with implicit imports
Summary: inconsistent behavior with implicit imports
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-09 17:43 UTC by thelastmammoth
Modified: 2022-09-08 09:00 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description thelastmammoth 2012-09-09 17:43:50 UTC
(bug filed in response to http://forum.dlang.org/thread/tscjzueypzuiptpkvxrb@forum.dlang.org)

This compiles but shouldn't: (needs explicit import)
----
import std.stdio;
void main(){
	writeln(std.conv.to!double(1));
}
----

This doesn't compile (and shouldn't):
----
import std.stdio;
void main(){
	std.stdio.writeln(std.conv.to!double(1));
}
----
=>Error: undefined identifier std
Comment 1 thelastmammoth 2013-02-14 13:35:26 UTC
probably related:

---- fun.d
void test(){ std.file.write("", []);}
----
dmd -c fun.d
Error: undefined identifier std

---- fun.d
import std.stdio;
void test(){ std.file.write("", []);}
----
dmd -c fun.d
Error: undefined identifier 'file'


---- fun.d
import std.path;
void test(){ std.file.write("", []);}
----
dmd -c fun.d
compiles but shouldn't.

What's also weird is the difference in error msg in case 1 and 2 above.
Comment 2 thelastmammoth 2013-02-14 13:36:48 UTC
probably related:

---- fun.d
void test(){ std.file.write("", []);}
----
dmd -c fun.d
Error: undefined identifier std

---- fun.d
import std.stdio;
void test(){ std.file.write("", []);}
----
dmd -c fun.d
Error: undefined identifier 'file'


---- fun.d
import std.path;
void test(){ std.file.write("", []);}
----
dmd -c fun.d
compiles but shouldn't.

What's also weird is the difference in error msg in case 1 and 2 above.
Comment 3 RazvanN 2022-09-08 09:00:41 UTC
I cannot reproduce the original bug report. Closing as worksforme.