Boost C++ Libraries: Ticket #9517: boost gil compile error because of type narrowing https://svn.boost.org/trac10/ticket/9517 <p> line 204 in boost/gil/channel_algorithm.hpp if (src &gt; unsigned_integral_max_value&lt;uintmax_t&gt;::value - div2) gives me this error with clang error: non-type template argument </p> <blockquote> <p> evaluates to -1, which cannot be narrowed to type 'unsigned long' [-Wc++11-narrowing] </p> </blockquote> <p> struct unsigned_integral_max_value : public mpl::integral_c&lt;<a class="missing wiki">UnsignedIntegralChannel</a>,-1&gt; {}; </p> <p> can you just replace with std::numeric_limits&lt;unitmax_t&gt;::max()? </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9517 Trac 1.4.3 william@… Fri, 09 May 2014 17:26:43 GMT cc set https://svn.boost.org/trac10/ticket/9517#comment:1 https://svn.boost.org/trac10/ticket/9517#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">william@…</span> added </li> </ul> <p> This error persists in Boost 1.55 using clang of Xcode 5.1 on Mac OS 10.9 (Don't see how to select multiple values for the version field here!) </p> Ticket William Gallafent <william@…> Fri, 09 May 2014 18:19:40 GMT <link>https://svn.boost.org/trac10/ticket/9517#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9517#comment:2</guid> <description> <p> … incidentally, I went for a std:: numeric_limits &lt;<a class="missing wiki">UnsignedIntegralChannel</a>&gt;:: max () instead … not sure which is more correct in this context. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 27 Aug 2015 10:21:45 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9517#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9517#comment:3</guid> <description> <p> I am facing the same problem in the same file, with Boost 1.57, on line 54. Does someone knows the status of this ? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Mateusz Loskot</dc:creator> <pubDate>Thu, 16 Feb 2017 10:52:39 GMT</pubDate> <title>cc changed https://svn.boost.org/trac10/ticket/9517#comment:4 https://svn.boost.org/trac10/ticket/9517#comment:4 <ul> <li><strong>cc</strong> <span class="trac-author">mateusz@…</span> added </li> </ul> Ticket frederic.bron@… Wed, 10 May 2017 07:17:59 GMT attachment set https://svn.boost.org/trac10/ticket/9517 https://svn.boost.org/trac10/ticket/9517 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">gil_channel_algorithm.patch</span> </li> </ul> <p> patch </p> Ticket frederic.bron@… Wed, 10 May 2017 07:21:38 GMT <link>https://svn.boost.org/trac10/ticket/9517#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9517#comment:5</guid> <description> <p> This is easy to to fix. integral_c is defined by: template&lt; typename T, T N &gt; struct integral_c; </p> <p> So the 2nd template parameter is of type T=<a class="missing wiki">UnsignedIntegralChannel</a>. </p> <p> Therefore, -1 can easily be replaced by either std::numeric_limits&lt;<a class="missing wiki">UnsignedIntegralChannel</a>&gt;::max() or static_cast&lt;<a class="missing wiki">UnsignedIntegralChannel</a>&gt;(-1) </p> <p> See patch attached. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Stefan Seefeld</dc:creator> <pubDate>Sat, 01 Jul 2017 21:16:10 GMT</pubDate> <title>owner changed https://svn.boost.org/trac10/ticket/9517#comment:6 https://svn.boost.org/trac10/ticket/9517#comment:6 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Hailin Jin</span> to <span class="trac-author">Stefan Seefeld</span> </li> </ul> Ticket Mateusz Loskot Mon, 09 Apr 2018 15:17:12 GMT owner, status changed https://svn.boost.org/trac10/ticket/9517#comment:7 https://svn.boost.org/trac10/ticket/9517#comment:7 <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:17:25 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/9517#comment:8 https://svn.boost.org/trac10/ticket/9517#comment:8 <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> Duplicate of <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7270" title="#7270: Bugs: C++11 narrowing problem in gil (closed: fixed)">#7270</a> (already fixed) </p> Ticket Mateusz Loskot Mon, 09 Apr 2018 15:18:04 GMT version changed https://svn.boost.org/trac10/ticket/9517#comment:9 https://svn.boost.org/trac10/ticket/9517#comment:9 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.54.0</span> → <span class="trac-field-new">Boost Development Trunk</span> </li> </ul> Ticket Mateusz Loskot Mon, 09 Apr 2018 15:18:33 GMT version, milestone changed https://svn.boost.org/trac10/ticket/9517#comment:10 https://svn.boost.org/trac10/ticket/9517#comment:10 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost Development Trunk</span> → <span class="trac-field-new">Boost 1.54.0</span> </li> <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