[Issue 3979] New: Order-of-compilation and forward reference errors
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Mar 17 01:39:41 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3979
Summary: Order-of-compilation and forward reference errors
Product: D
Version: 2.041
Platform: Other
OS/Version: All
Status: NEW
Severity: blocker
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bugzilla at kyllingen.net
--- Comment #0 from Lars T. Kyllingstad <bugzilla at kyllingen.net> 2010-03-17 01:39:39 PDT ---
I've run into this while working on std.process. Take the following two files:
// This is a.d:
import std.stdio;
// This is process.d:
module std.process;
import std.stdio;
void foo(File f = std.stdio.stdin);
Compile them in the order they're written here, and you get a nonsensical
error:
lars at neutrino:~/tmp$ dmd -c a.d process.d
process.d(3): Error: cannot implicitly convert expression (stdin)
of type File to File
Make the following change to process.d:
module std.process;
import std.stdio: File, stdin; // Selective imports now
void foo(File f = std.stdio.stdin);
This causes an additional forward reference error:
lars at neutrino:~/tmp$ dmd -c a.d process.d
process.d(2): Error: alias std.process.stdin forward reference of
stdin
process.d(3): Error: cannot implicitly convert expression (stdin)
of type File to File
Compile them in reverse order, and it works fine in both cases:
lars at neutrino:~/tmp$ dmd -c process.d a.d
Note: I'm marking this as a blocker because it's rather crucial to the new
std.process design, and I don't want to muck about with Andrei's makefile just
to make it compile.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list