Boost logo

Boost Users :

Subject: [Boost-users] [program_options] Multitoken and positional options; assertion failure
From: Gevorg Voskanyan (v_gevorg_at_[hidden])
Date: 2009-04-16 09:10:18


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

      



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net