[Issue 8417] New: Better error message on invalid operator call

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 22 15:09:50 PDT 2012


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

           Summary: Better error message on invalid operator call
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-07-22 15:09:50 PDT ---
import std.getopt;

void main(string[] args)
{
    string foo;
    getopt(args,
           "foo"         &foo
    );
}

Notice that a comma is missing after "foo". The errors leak into getopt:

bug_new.d(19): Error: '"foo"' is not of integral type, it is a string
bug_new.d(19): Error: 'foo' is not of integral type, it is a string
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\getopt.d(386): Error: array index
[1] is outside array bounds [0 .. 1]
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\getopt.d(508): Error: using * on
an array is deprecated; use *(receiver).ptr instead
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\getopt.d(513): Error: using * on
an array is deprecated; use *(receiver).ptr instead
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\getopt.d(524): Error: static
assert  "Dunno how to deal with type string"
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\getopt.d(394):        instantiated
from here: handleOption!(string)
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\getopt.d(345):        instantiated
from here: getoptImpl!(string)
bug_new.d(18):        instantiated from here: getopt!(string)
Failed: "dmd" "-unittest" "-w" "-J." "-v" "-o-" "bug_new.d" "-I."
>Exit code: 1

-- 
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