[Boost-bugs] [Boost C++ Libraries] #3813: program_options::options_description.add() permits duplicate options

Subject: [Boost-bugs] [Boost C++ Libraries] #3813: program_options::options_description.add() permits duplicate options
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-01-03 17:00:43


#3813: program_options::options_description.add() permits duplicate options
--------------------------------------------------------+-------------------
 Reporter: Matthew Wesley <weslem-boosttrac@…> | Owner: vladimir_prus
     Type: Bugs | Status: new
Milestone: Boost 1.42.0 | Component: program_options
  Version: Boost 1.41.0 | Severity: Problem
 Keywords: |
--------------------------------------------------------+-------------------
 The documentations for options_description.add() says it will through
 duplicate_variable_error for duplicate short or long options. I have check
 versions 1.32.0 and 1.41.0, and both permit this code:
 {{{
 #include <boost/program_options.hpp>
 #include <iostream>

 namespace po = boost::program_options;

 int main()
 {
     po::options_description opts;

     opts.add_options()
         ("help", "first --help")
         ("help", "second --help")
         ;
     opts.add_options()
         ("alpha,a", "first -a")
         ("apple,a", "second -a")
         ;


     std::cout << opts;

     return 0;
 }
 }}}

 Producing this output:
 {{{
   --help first --help
   --help second --help
   -a [ --alpha ] first -a
   -a [ --apple ] second -a
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3813>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC