http://d.puremagic.com/issues/show_bug.cgi?id=10955
Summary: std.getopt errors internally when insufficient
arguments are passed
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Optlink
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Andrej Mitrovic <[email protected]> 2013-09-03
09:24:37 PDT ---
-----
import std.getopt;
void main(string[] args)
{
int i;
getopt(args, &i);
}
-----
std\getopt.d(392): Error: array index [1] is outside array bounds [0 .. 1]
std\getopt.d(401): Error: string slice [2 .. 1] is out of bounds
std\getopt.d(401): Error: cannot return non-void from void function
std\getopt.d(351): Error: template instance std.getopt.getoptImpl!(int*) error
instantiating
I think we can fix this easily:
before:
void getopt(T...)(ref string[] args, T opts) {
after:
void getopt(T...)(ref string[] args, T opts) if (T.length > 1) {
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------