[program_options] Multitoken and positional options; assertion failure

I was playing with program_options in svn trunk after recent fixes for multitoken options and hit an assertion failure with the attached example. The example takes two options - one multitoken and one positional, and simply outputs provided values. The two invocations below work OK: $ bin/gcc-4.2.2/debug/multitoken_positional some_file -m token1 token2 File: some_file Multitoken: token1 token2 $ bin/gcc-4.2.2/debug/multitoken_positional -m token1 token2 --file some_file File: some_file Multitoken: token1 token2 While experimenting with this one asserts: $ bin/gcc-4.2.2/debug/multitoken_positional -m token1 token2 -- some_file multitoken_positional: ../../../../../svn_boost/trunk/libs/program_options/src/cmdline.cpp:295: std::vector<boost::program_options::basic_option<char>, std::allocator<boost::program_options::basic_option<char> > > boost::program_options::detail::cmdline::run(): Assertion `opt2.original_tokens.size() == 1' failed. Aborted Should an exception be thrown instead, or this is a use-case worth to support? Thanks, Gevorg

Gevorg Voskanyan wrote:
While experimenting with this one asserts:
$ bin/gcc-4.2.2/debug/multitoken_positional -m token1 token2 -- some_file multitoken_positional: ../../../../../svn_boost/trunk/libs/program_options/src/cmdline.cpp:295: std::vector<boost::program_options::basic_option<char>, std::allocator<boost::program_options::basic_option<char> > > boost::program_options::detail::cmdline::run(): Assertion `opt2.original_tokens.size() == 1' failed. Aborted
Should an exception be thrown instead, or this is a use-case worth to support?
Gevorg, thank you for providing a test case -- it is a great help to diagnose the problem. This should be now fixed in SVN HEAD: https://svn.boost.org/trac/boost/changeset/52440 Thanks, Volodya

Vladimir Prus wrote:
Gevorg,
thank you for providing a test case -- it is a great help to diagnose the problem. This should be now fixed in SVN HEAD:
https://svn.boost.org/trac/boost/changeset/52440
Thanks, Volodya
Thanks Volodya for the fix! I updated and now it works like a charm. Best Regards, Gevorg
participants (2)
-
Gevorg Voskanyan
-
Vladimir Prus