Hi Mike!

> The attached patch should fix the issue, although it's not completely
> clear to me if these were hidden (until now) mistakes or not.

It actually looks like those were mistakes and the proper fix would have
been to use braces around the next two statements, so that argv.erase()
is executed when "isOption(maybepos)" is false:

if (!isOption(maybepos)) {
        /* not an option */
        value = argv[1];
        argv.erase(argv.begin() + 1);
}

This becomes obvious when you scroll down further in the case statement
at case Option::Required: where we have:

if (isOption(maybepos))
        /* The next argv is an option */
        return;

value = argv[1];
argv.erase(argv.begin() + 1);

So, the two statements are always executed when isOption(maybepos) is false.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

Reply via email to