www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8082] New: Invalid error messages based on module compilation order

reply d-bugmail puremagic.com writes:
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: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



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: -------
May 11 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8082


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME



14:30:14 PDT ---
Seems to be fixed in 2.063.2.

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