Bug 15914 – [REG 2.071] getopt doesn't accept anymore a character for a bool option
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-04-12T06:48:00Z
Last change time
2016-06-18T12:31:46Z
Assigned to
nobody
Creator
b2.temp
Comments
Comment #0 by b2.temp — 2016-04-12T06:48:19Z
Comment #1 by dlang-bugzilla — 2016-04-12T06:54:11Z
Please provide a minimum self-contained example.
Comment #2 by b2.temp — 2016-04-12T07:10:56Z
Actually even if the option validator is commented, the following test is not compiled
unittest
{
bool opt;
string args;
getopt(args, config.passThrough 'a', &opt);
}�
so the problem comes from somewhere else.
There's nothing in the file history that explicitly remove this feature between 2.070 and 2.071.
Comment #3 by b2.temp — 2016-04-12T07:11:08Z
Actually even if the option validator is commented, the following test is not compiled
unittest
{
bool opt;
string args;
getopt(args, config.passThrough 'a', &opt);
}�
so the problem comes from somewhere else.
There's nothing in the file history that explicitly remove this feature between 2.070 and 2.071.
Comment #4 by b2.temp — 2016-04-12T07:13:40Z
(In reply to b2.temp from comment #3)
> Actually even if the option validator is commented, the following test is
> not compiled
somment line 626:
static assert(validationMessage == "", validationMessage);
unittest
{
bool opt;
string args;
getopt(args, config.passThrough, 'a', &opt);
}
Comment #5 by b2.temp — 2016-04-12T07:14:21Z
I meant "comment" the line
Comment #6 by dlang-bugzilla — 2016-04-12T07:15:44Z
(In reply to b2.temp from comment #3)
> unittest
> {
> bool opt;
> string args;
> getopt(args, config.passThrough 'a', &opt);
> }
This example never worked.
Even after you add the missing comma and delete the strange character at the end.
Please post an actual complete program that can be copied and pasted into a .d file which will compile with an older version but not a newer one.
Comment #7 by dlang-bugzilla — 2016-04-12T07:17:08Z
If you land here because you're affected by the regression a simple fix consist into replacing the character by a string.
getOpt(args, "a", &a)
A fix is prepared for the next release.
Comment #11 by github-bugzilla — 2016-04-15T15:23:16Z