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: nob...@puremagic.com
        ReportedBy: bugzi...@kyllingen.net


--- Comment #0 from Lars T. Kyllingstad <bugzi...@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:

    l...@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:

    l...@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:

    l...@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: -------

Reply via email to