www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10956] New: std.getopt error on wrongly position arguments should improve

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

           Summary: std.getopt error on wrongly position arguments should
                    improve
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-09-03
09:30:22 PDT ---
-----
import std.getopt;

void main(string[] args)
{
    int i;
    getopt(args, &i, "");
}
-----

This call is wrong, the text argument should come before the pointer, but the
diagnostics are bad:

std\getopt.d(499): Deprecation: using * on an array is deprecated; use
*(receiver).ptr instead
std\getopt.d(499): Error: cannot modify immutable expression
*cast(immutable(char)*)receiver
std\getopt.d(500): Deprecation: using * on an array is deprecated; use
*(receiver).ptr instead
std\getopt.d(500): Deprecation: using * on an array is deprecated; use
*(receiver).ptr instead
std\getopt.d(500): Error: cannot modify immutable expression
*cast(immutable(char)*)receiver
std\getopt.d(400): Error: template instance std.getopt.handleOption!string
error instantiating
std\getopt.d(351):        instantiated from here: getoptImpl!(int*, string)
test.d(8):        instantiated from here: getopt!(int*, string)
std\getopt.d(351): Error: template instance std.getopt.getoptImpl!(int*,
string) error instantiating
test.d(8):        instantiated from here: getopt!(int*, string)
test.d(8): Error: template instance std.getopt.getopt!(int*, string) error
instantiating

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