http://d.puremagic.com/issues/show_bug.cgi?id=8082

           Summary: Invalid error messages based on module compilation
                    order
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2012-05-11 
02:56:30 PDT ---
main.d that references an undefined function:

module main;
void main() {
    test();  // invalid call
}

and util.d:

module util;
import std.algorithm;
bool canFindAny(string[] inputs, string target1)
{
    foreach (input; inputs)
    {
        if (target1.canFind(input))
            return true;
    }

    return false;
}

$ dmd main.d util.d
main.d(4): Error: undefined identifier test
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(2837): Error: template
std.algorithm.find does not match any function template declaration
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(2837): Error: template
std.algorithm.find cannot deduce template function from argument types !("a ==
b",ubyte[],ubyte[])(ubyte[],ubyte[])
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(2836): Error: template
instance find!("a == b",ubyte[],ubyte[]) errors instantiating template

Only the first error message should appear. If you comment out the call to
"test()" in main.d, all errors are gone.

Note that the order of compiling the modules changes the behavior, see:

$ dmd util.d main.d
$ main.d(4): Error: undefined identifier test

$ dmd main.d util.d
$ main.d(4): Error: undefined identifier test
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(2837): Error: template
std.algorithm.find does not match any function template declaration
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(2837): Error: template
std.algorithm.find cannot deduce template function from argument types !("a ==
b",ubyte[],ubyte[])(ubyte[],ubyte[])
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(2836): Error: template
instance find!("a == b",ubyte[],ubyte[]) errors instantiating template

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to