Please provide a minimum self-contained example.
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.
(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); }
I meant "comment" the line
(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.
Figured it out. Complete example: //////////////////// test.d //////////////////// import std.getopt; void main() { bool opt; string[] args; getopt(args, config.passThrough, 'a', &opt); } ////////////////////////////////////////////////
Introduced in https://github.com/D-Programming-Language/phobos/pull/3859
Commit pushed to revert-3859-getopt-checker at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/cedfb8c153b910e2d9e82112b2cbe519cd870491 std.getopt: Add unit test for issue 15914
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.
Commits pushed to stable at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/4a21631a0f35c75b2e22031248245f362c1a021d fix issue 15914 https://github.com/D-Programming-Language/phobos/commit/def9039f4252df4d17770513e53ee4bdcb20ce61 Merge pull request #4189 from BBasile/issue-15914-stable fix issue 15914 - [REG 2.071] getopt doesn't accept anymore a character for a bool option
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/4a21631a0f35c75b2e22031248245f362c1a021d fix issue 15914 https://github.com/dlang/phobos/commit/def9039f4252df4d17770513e53ee4bdcb20ce61 Merge pull request #4189 from BBasile/issue-15914-stable