Subject: Re: [boost] [fusion] view gcc 4.6
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2011-11-19 21:48:57
> the following code does not compile with gcc 4.6.1:
> #include <boost/fusion/view.hpp>
> int main( int argc , char ** argv )
> return 0;
> It produces errors like this:
> error: overflow in constant expression [-fpermissive]
> note: in template argument for type int
I think I know what the problem is!
The problem is that this line in fusion/view/nview/detail/nview_impl.hpp:
, BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(FUSION_MAX_VECTOR_SIZE, int I, LONG_MAX)>
expands to code like
, int I0 = 2147483647L , int I1 = 2147483647L , int I2 = 2147483647L , int I3 = 2147483647L , int I4 = 2147483647L , int I5 = 2147483647L , int I6 = 2147483647L , int I7 = 2147483647L , int I8 = 2147483647L , int I9 = 2147483647L >
Note that that's an "int I", but a "LONG_MAX". The OP must be using a system where int and long have
different sizes, and so LONG_MAX is too large on an integer to be used as a default parameter for
an int template argument.
Joel and I don't see the issue because on our systems, int and long has the same size.
The solution, then, would be to replace LONG_MAX with INT_MAX on that line.
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk