Boost C++ Libraries: Ticket #5268: mpl::int_<INT_MIN> fails to compile under g++-4.6 although g++-4.5 works. https://svn.boost.org/trac10/ticket/5268 <p> Under Debian Sid with a 2.6.36 AMD_64 kernel, and g++-4.6, the following code: </p> <pre class="wiki">#include &lt;climits&gt; #include &lt;boost/mpl/int.hpp&gt; boost::mpl::int_&lt;INT_MIN&gt; foo; </pre><p> Produces the errors: </p> <pre class="wiki">/usr/local/include/boost/mpl/aux_/integral_wrapper.hpp: In instantiation of ‘mpl_::int_&lt;-0x00000000080000000&gt;’: 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] </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5268 Trac 1.4.3 Stirling Westrup <swestrup@…> Mon, 07 Mar 2011 17:21:25 GMT <link>https://svn.boost.org/trac10/ticket/5268#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5268#comment:1</guid> <description> <p> I also reported this bug to GCC, and this is what they had to say about it: </p> <blockquote> <p> <a class="ext-link" href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#699"><span class="icon">​</span>http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#699</a> added integer overflow ("a result that is not mathematically defined or not in the range of representable values for its type") to the list of things that cause an expression to not be a constant expression </p> </blockquote> <blockquote> <p> The non-type template argument needs to be an integral constant-expression, but it's not a constant expression due to the overflow, so the code is invalid. </p> </blockquote> <blockquote> <p> Whether it should be accepted with -fpermissive is a separate matter, as is the quality of diagnostic. </p> </blockquote> <p> So, it appears to be a genuine bug in mpl, which will need to be fixed. </p> </description> <category>Ticket</category> </item> </channel> </rss>