[Boost-bugs] [Boost C++ Libraries] #11031: Configuration RTTI macros doesn't work correctly with boost typeindex

Subject: [Boost-bugs] [Boost C++ Libraries] #11031: Configuration RTTI macros doesn't work correctly with boost typeindex
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-02-16 13:38:35


#11031: Configuration RTTI macros doesn't work correctly with boost typeindex
------------------------------+------------------------
 Reporter: anonymous | Owner: apolukhin
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: type_index
  Version: Boost 1.57.0 | Severity: Problem
 Keywords: |
------------------------------+------------------------
 Hi,

 After updating from Boost 1.56 to 1.57 I got some issues with
 program_options parser. After some checking I've found out that the reason
 are macros I use during compilation:[[BR]]
 -BOOST_NO_RTTI[[BR]]
 -BOOST_NO_TYPEID[[BR]]

 I've debugged situation with BOOST_NO_RTTI flag. What is strange in that
 case function:

 {{{
 template<typename ValueType>
     ValueType * any_cast(any * operand) BOOST_NOEXCEPT
 }}}

 calls finally function from class type_index_facade

 {{{
 inline bool equal(const Derived& rhs) const BOOST_NOEXCEPT
 }}}

 where it is comparing type_id from ctti and std!!! What is even more
 interesting it happen only for bool type, int works fine.

 I was able to reproduce my problem on:[[BR]]
 - gcc (GCC) 4.8.1 from MinGW on Windows 7[[BR]]
 - arm-poky-linux-gnueabi-g++ (Linaro GCC 4.8-2014.04) 4.8.3 20140401
 (prerelease) on ARM archotecture.


 Here is sample code:


 {{{
 #include <boost/program_options.hpp>
 #include <strstream>
 #include <iostream>
 #include <boost/version.hpp>

 static char const CONFIG_STRING[] = "AAAAA_THIS_IS_NOT_WORKING_ = true";

 class testA
 {
 public:
     testA(void);

     bool AAAAA_THIS_IS_NOT_WORKING_;
     int AA_THIS_WORKS;
 };

 testA::testA(void)
         : AAAAA_THIS_IS_NOT_WORKING_(false)
 {

     namespace po = boost::program_options;

     po::options_description config("Configuration");
     config.add_options()("AAAAA_THIS_IS_NOT_WORKING_",
 boost::program_options::value<bool>(&AAAAA_THIS_IS_NOT_WORKING_), "")
                          ("AA_THIS_WORKS",
 boost::program_options::value<int>(&AA_THIS_WORKS), "");

     po::options_description configFileOptions;
     (void) configFileOptions.add(config);

     std::cout << "parsing" << std::endl;
     std::cout << "current bool value: " <<
 this->AAAAA_THIS_IS_NOT_WORKING_ << std::endl;
     std::cout << "current int value: " << this->AA_THIS_WORKS <<
 std::endl;
     std::strstream configStream;
     configStream << CONFIG_STRING;
     po::variables_map varMap;
     po::store(po::parse_config_file(configStream, configFileOptions),
 varMap);
     po::notify(varMap);
     std::cout << "done" << std::endl;
     std::cout << "current bool value: " <<
 this->AAAAA_THIS_IS_NOT_WORKING_ << std::endl;
     std::cout << "current int value: " << this->AA_THIS_WORKS <<
 std::endl;
 }

 int
 main()
 {
     std::cout << "version: 1.5" << std::endl;
     std::cout << "BOOST version: " << BOOST_LIB_VERSION << std::endl;
     const testA A;
     return 0;
 }
 }}}

 compilation flags:[[BR]]
 CFLAGS=-DBOOST_NO_RTTI[[BR]]
 or [[BR]]
 CFLAGS=-DBOOST_NO_TYPEID[[BR]]

 linker flags:[[BR]]
 LFLAGS=-lboost_program_options


 Best regards,[[BR]]
 Wiktor Drewniak[[BR]]
 wiktor.drewniak_at_[hidden]

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11031>
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:17 UTC