[Boost-bugs] [Boost C++ Libraries] #9132: mpl and lexical_cast dependency

Subject: [Boost-bugs] [Boost C++ Libraries] #9132: mpl and lexical_cast dependency
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-09-19 10:18:24


#9132: mpl and lexical_cast dependency
------------------------------+-----------------------
 Reporter: mkp | Owner: agurtovoy
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: mpl
  Version: Boost 1.54.0 | Severity: Problem
 Keywords: |
------------------------------+-----------------------
 Hi,

 It took mi one day to find out why my msm stopped to compile after
 upgrading to new boost. I was upgrading from 1.45 (with msm from 1.51) to
 1.53. After many tries with different #define's it turned out the problem
 is elsewhere. This is code that breaks compilation:

 {{{
 #include <boost/lexical_cast.hpp>

 #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
 #define BOOST_MPL_LIMIT_VECTOR_SIZE 30
 #include <boost/mpl/vector.hpp>

 int main()
 {
         boost::mpl::vector<int, char, double, int, int, int, int, int,
 int, char,
                            int, char, double, int, int, int, int, int,
 int, char,
                            int> v;
 }
 }}}

 and compilation output:

 {{{
 g++ -Wall -Wextra -pedantic -Wlong-long plik.C -o plik -O2 -I
 /bldtools/3rd/boost/boost1.53/32bitrhel63/include -Wno-unused
 plik.C:13:1: warning: "BOOST_MPL_LIMIT_VECTOR_SIZE" redefined
 In file included from
 /bldtools/3rd/boost/boost1.53/32bitrhel63/include/boost/mpl/vector.hpp:18,
                  from
 /bldtools/3rd/boost/boost1.53/32bitrhel63/include/boost/math/policies/policy.hpp:14,
                  from
 /bldtools/3rd/boost/boost1.53/32bitrhel63/include/boost/math/special_functions/math_fwd.hpp:28,
                  from
 /bldtools/3rd/boost/boost1.53/32bitrhel63/include/boost/math/special_functions/sign.hpp:17,
                  from
 /bldtools/3rd/boost/boost1.53/32bitrhel63/include/boost/lexical_cast.hpp:167,
                  from plik.C:10:
 /bldtools/3rd/boost/boost1.53/32bitrhel63/include/boost/mpl/limits/vector.hpp:18:1:
 warning: this is the location of the previous definition
 plik.C: In function âint main()â:
 plik.C:41: error: wrong number of template arguments (21, should be 20)
 /bldtools/3rd/boost/boost1.53/32bitrhel63/include/boost/mpl/aux_/preprocessed/gcc/vector.hpp:22:
 error: provided for âtemplate<class T0, class T1, class T2, class T3,
 class T4, class T5, class T6, class T7, class T8, class T9, class T10,
 class T11, class T12, class T13, class T14, class T15, class T16, class
 T17, class T18, class T19> struct boost::mpl::vectorâ
 plik.C:41: error: invalid type in declaration before â;â token
 make: *** [plik] Error 1
 }}}

 Removing lexical_cast fixes the problem. Looks like lexical_cast started
 to use mpl vector with default settings and later #define's don't change
 the settings.

 The issue is complicated because it is not enough to move #define's at the
 beginning of file. I had to modify all my *.hpp files to include msm
 headers (and #define's) at the beginning of file. And also *.cpp files to
 include the above *.hpp at the beginning of file :(.

 Regards,

 Marcin Pytel

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