Boost C++ Libraries: Ticket #7270: C++11 narrowing problem in gil https://svn.boost.org/trac10/ticket/7270 <p> Compiling against Boost.Gil on Clang with C++11 extensions enabled, I get an error about narrowing in channel_algorithms.hpp. The attached patch fixes the problem and works fine with C++03 as well. </p> <p> The clang version is compiled from svn, running on Ubuntu 10.04: clang version 3.2 (trunk 162287) Target: x86_64-unknown-linux-gnu Thread model: posix </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7270 Trac 1.4.3 Jim Bosch Thu, 23 Aug 2012 22:59:02 GMT attachment set https://svn.boost.org/trac10/ticket/7270 https://svn.boost.org/trac10/ticket/7270 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-gil-clang-c++11-narrowing.patch</span> </li> </ul> <p> updated patch that avoids introducing a new problem </p> Ticket Jim Bosch Thu, 23 Aug 2012 23:00:15 GMT <link>https://svn.boost.org/trac10/ticket/7270#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7270#comment:1</guid> <description> <p> Looking closer, my original patch would solve the problem but probably create some new ones, by always casting to unsigned int instead of the template parameter type. I've now attached a new patch that avoids mistake. </p> <p> It also looks like one of the partial specializations of the template in the same area could cause problems for C++11, depending on the types it was instantiated with. I'll leave fixing that up to someone more familiar with its purpose. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>chhenning</dc:creator> <pubDate>Mon, 04 Feb 2013 19:28:27 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7270#comment:2 https://svn.boost.org/trac10/ticket/7270#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> This has been fixed. See ticket 7970 </p> Ticket babatakao@… Fri, 09 Dec 2016 01:59:01 GMT status, version changed; resolution deleted https://svn.boost.org/trac10/ticket/7270#comment:3 https://svn.boost.org/trac10/ticket/7270#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.51.0</span> → <span class="trac-field-new">Boost 1.63.0</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> boost 1.61 still causes the error with clang: Apple LLVM version 7.3.0 (clang-703.0.31) </p> <pre class="wiki">/buildroot/libs/boost/include/boost/gil/channel_algorithm.hpp:55:85: error: non-type template argument evaluates to -1, which cannot be narrowed to type 'unsigned long' [-Wc++11-narrowing] struct unsigned_integral_max_value : public mpl::integral_c&lt;UnsignedIntegralChannel,-1&gt; {}; ^ /buildroot/libs/boost/include/boost/gil/channel_algorithm.hpp:55:85: /libs/boost/include/boost/gil/channel_algorithm.hpp:205:19: note: in instantiation of template class 'boost::gil::detail::unsigned_integral_max_value&lt;unsigned long&gt;' requested here if (src &gt; unsigned_integral_max_value&lt;uintmax_t&gt;::value - div2) ^ 1 error generated. </pre><p> and it does not seem to be fixed on boost 1.63.0 beta1. </p> <p> (The error occurs only if "-std=c++11" is given.) </p> <p> "boost-gil-clang-c++11-narrowing.patch" fixes the error. </p> Ticket Mateusz Loskot Thu, 16 Feb 2017 10:51:18 GMT cc set https://svn.boost.org/trac10/ticket/7270#comment:4 https://svn.boost.org/trac10/ticket/7270#comment:4 <ul> <li><strong>cc</strong> <span class="trac-author">mateusz@…</span> added </li> </ul> Ticket Stefan Seefeld Sat, 01 Jul 2017 21:14:32 GMT owner, status changed https://svn.boost.org/trac10/ticket/7270#comment:5 https://svn.boost.org/trac10/ticket/7270#comment:5 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Hailin Jin</span> to <span class="trac-author">Stefan Seefeld</span> </li> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">new</span> </li> </ul> Ticket Mateusz Loskot Mon, 09 Apr 2018 15:15:09 GMT owner, status changed https://svn.boost.org/trac10/ticket/7270#comment:6 https://svn.boost.org/trac10/ticket/7270#comment:6 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Stefan Seefeld</span> to <span class="trac-author">Mateusz Loskot</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket Mateusz Loskot Mon, 09 Apr 2018 15:15:46 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/7270#comment:7 https://svn.boost.org/trac10/ticket/7270#comment:7 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> This should have been fixed by <a class="ext-link" href="https://github.com/boostorg/gil/commit/e3cba43c16e1958e8dac1ca9cb5745d9d6a68068"><span class="icon">​</span>https://github.com/boostorg/gil/commit/e3cba43c16e1958e8dac1ca9cb5745d9d6a68068</a> (Feb 6, 2013) </p> Ticket Mateusz Loskot Mon, 09 Apr 2018 15:18:36 GMT milestone changed https://svn.boost.org/trac10/ticket/7270#comment:8 https://svn.boost.org/trac10/ticket/7270#comment:8 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.68.0</span> </li> </ul> Ticket