Boost logo

Boost :

Subject: [boost] [mpl] int_<INT_MIN> fails to compile under gcc 4.6
From: Stirling Westrup (swestrup_at_[hidden])
Date: 2011-03-05 13:09:03


I'm not actually sure if this is a gcc regression, or a bug in mpl,
but the following code, which compiles under gcc 4.5, doesn't do so
under gcc 4.6:

#include <climits>
#include <boost/mpl/int.hpp>
typedef boost::mpl::int_<INT_MIN> Foo;
Foo f;

It produces the errors:

/usr/local/include/boost/mpl/aux_/integral_wrapper.hpp: In
instantiation of ‘mpl_::int_<-0x00000000080000000>’:
test_test.cpp:8:27: instantiated from here
/usr/local/include/boost/mpl/aux_/integral_wrapper.hpp:73:96: error:
‘2147483647’ is not a valid template argument for type ‘int’ because
it is a non-constant expression
/usr/local/include/boost/mpl/aux_/integral_wrapper.hpp:73:96: error:
overflow in constant expression [-fpermissive]

I've already created a trak ticket for this (#5268), but was wondering
if anyone had any insights as to its cause and/or any workarounds. My
guess is that its related to gcc rewriting parts of its constant
folding code to support constexpr.

-- 
Stirling Westrup
Programmer, Entrepreneur.
https://www.linkedin.com/e/fpf/77228
http://www.linkedin.com/in/swestrup
http://technaut.livejournal.com
http://sourceforge.net/users/stirlingwestrup

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk