Is it a bug in std.getopt.config.stopOnFirstNonOption?

Andrey Zherikov andrey.zherikov at
Fri Aug 16 21:07:26 UTC 2019

Here is the code I have which doesn't work:
string[]       foo;
string[]       bar;

auto args = ["app", "--bar", "bar", "--foo", "foo"];  // (1)

import std.getopt;
        std.getopt.config.stopOnFirstNonOption,   // (2)
        "foo", &foo,
        "bar", &bar);

The error I see:
std.getopt.GetOptException at c:\D\dmd-2.086.1\windows\bin\..\..\src\phobos\std\getopt.d(792): Unrecognized option --foo

- if I change line (1) to `auto args = ["app", "--foo", "foo", 
"--bar", "bar"];` then this code works.
- if I remove line (2) then this code works.

What am I doing wrong?

More information about the Digitalmars-d-learn mailing list