[Issue 19335] New: std.getopt: make it an error to have options that differ only by case when case insensitive
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Oct 26 04:32:17 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19335
Issue ID: 19335
Summary: std.getopt: make it an error to have options that
differ only by case when case insensitive
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: dhasenan at gmail.com
void main(string[] args)
{
import std.getopt;
import std.stdio;
int a, A;
getopt(args, "a", &a, "A", &A);
writefln("a=%s, A=%s", a, A);
}
Compile, run with `-a 5 -A 10`.
The expected result is an exception saying that option `A|a` is multiply
defined, hopefully also mentioning that the case-sensitive flag exists.
The actual result is that `a` is set twice and `A` is not set.
This exception should also trigger when you define an argument named `H`.
(I would also argue that case-insensitive is a terrible default, but that's
unlikely to change.)
--
More information about the Digitalmars-d-bugs
mailing list