Boost C++ Libraries: Ticket #9725: dynamic_bitset.hpp: implicit conversion changes signedness https://svn.boost.org/trac10/ticket/9725 <p> When compiling code against boost-1.55.0 (on NetBSD-6.99.33/amd64 with clang-3.5 trunk 201163, but reportedly also on OS X with clang) I get signedness warnings when using dynamic_bitset.hpp: </p> <p> In file included from /usr/pkg/include/boost/dynamic_bitset.hpp:15: /usr/pkg/include/boost/dynamic_bitset/dynamic_bitset.hpp:1697:14: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] </p> <blockquote> <p> + static_cast&lt;int&gt;( num_bits % bits_per_block != 0 ); ~ <sup><del></del><del></del><del></del><del></del><del></del><del></del><del></del><del></del><del></del><del></del><del></del><del></del>~ </sup></p> </blockquote> <p> /usr/pkg/include/boost/dynamic_bitset/dynamic_bitset.hpp:388:23: note: in instantiation of member function 'boost::dynamic_bitset&lt;unsigned long, std::<span class="underline">1::allocator&lt;unsigned long&gt; &gt;::calc_num_blocks' requested h\ ere </span></p> <blockquote> <p> m_bits.resize(calc_num_blocks(num_bits)); </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> <p> /usr/pkg/include/boost/dynamic_bitset/dynamic_bitset.hpp:600:5: note: in instantiation of member function 'boost::dynamic_bitset&lt;unsigned long, std::<span class="underline">1::allocator&lt;unsigned long&gt; &gt;::init_from_unsigned_long' requ\ ested here </span></p> <blockquote> <p> init_from_unsigned_long(num_bits, value); <sup> </sup></p> </blockquote> <p> ../../../path/to/Table.cc:186:28: note: in instantiation of member function 'boost::dynamic_bitset&lt;unsigned long, std::<span class="underline">1::allocator&lt;unsigned long&gt; &gt;::dynamic_bitset' requested here </span></p> <blockquote> <p> Matches *matches = new Matches(get_num_rows()); </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> <p> In file included from /usr/pkg/include/boost/dynamic_bitset.hpp:15: /usr/pkg/include/boost/dynamic_bitset/dynamic_bitset.hpp:1233:33: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] </p> <blockquote> <p> return i * bits_per_block + boost::lowest_bit(m_bits[i]); </p> <blockquote> <p> ~ <sup><del></del><del></del><del></del><del></del><del></del><del></del><del>~ </del></sup></p> </blockquote> </blockquote> <p> /usr/pkg/include/boost/dynamic_bitset/dynamic_bitset.hpp:1242:12: note: in instantiation of member function 'boost::dynamic_bitset&lt;unsigned long, std::<span class="underline">1::allocator&lt;unsigned long&gt; &gt;::m_do_find_from' requested h\ ere </span></p> <blockquote> <p> return m_do_find_from(0); </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> <p> ../../../path/to/some.xs:145:30: note: in instantiation of member function 'boost::dynamic_bitset&lt;unsigned long, std::<span class="underline">1::allocator&lt;unsigned long&gt; &gt;::find_first' requested here </span></p> <blockquote> <p> for (size_t j = matches-&gt;find_first(); j != nfotex_gtl::Matches::npos; j = matches-&gt;find_next(j)) { </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> <p> In file included from /usr/pkg/include/boost/dynamic_bitset.hpp:15: /usr/pkg/include/boost/dynamic_bitset/dynamic_bitset.hpp:1264:32: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] </p> <blockquote> <p> blk * bits_per_block + lowest_bit(fore) </p> <blockquote> <p> ~ <sup><del></del><del></del><del></del><del>~ </del></sup></p> </blockquote> </blockquote> <p> ../../../path/to/some.xs:145:89: note: in instantiation of member function 'boost::dynamic_bitset&lt;unsigned long, std::<span class="underline">1::allocator&lt;unsigned long&gt; &gt;::find_next' requested here </span></p> <blockquote> <p> for (size_t j = matches-&gt;find_first(); j != nfotex_gtl::Matches::npos; j = matches-&gt;find_next(j)) { </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> <p> I've checked the git repository, the corresponding lines are unchanged since then. Attached is a patch adding casts that fixes this. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9725 Trac 1.4.3 Thomas Klausner <tk@…> Fri, 28 Feb 2014 10:43:03 GMT attachment set https://svn.boost.org/trac10/ticket/9725 https://svn.boost.org/trac10/ticket/9725 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">db.patch</span> </li> </ul> <p> Patch adding casts that fixes the warnings. </p> Ticket acharles Fri, 16 May 2014 14:10:58 GMT owner, milestone changed https://svn.boost.org/trac10/ticket/9725#comment:1 https://svn.boost.org/trac10/ticket/9725#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">jsiek</span> to <span class="trac-author">acharles</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.56.0</span> </li> </ul> <p> I'll take a look at this. </p> Ticket acharles Fri, 16 May 2014 14:12:40 GMT <link>https://svn.boost.org/trac10/ticket/9725#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9725#comment:2</guid> <description> <p> Additionally: Would you mind submitting this as a pull request on the repository with the ticket in the commit message? If you aren't very familiar with git/github, then I can do this. </p> </description> <category>Ticket</category> </item> <item> <author>Thomas Klausner <tk@…></author> <pubDate>Fri, 16 May 2014 15:46:23 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9725#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9725#comment:3</guid> <description> <p> I've just created a pull request. Thanks for looking at this! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>acharles</dc:creator> <pubDate>Fri, 16 May 2014 20:29:03 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9725#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9725#comment:4</guid> <description> <p> I don't see the pull request, could you paste a link? </p> <p> It should show up here: <a class="ext-link" href="https://github.com/boostorg/dynamic_bitset/pulls"><span class="icon">​</span>https://github.com/boostorg/dynamic_bitset/pulls</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>acharles</dc:creator> <pubDate>Fri, 16 May 2014 20:35:15 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9725#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9725#comment:5</guid> <description> <p> Nevermind, someone else merged it. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>acharles</dc:creator> <pubDate>Fri, 16 May 2014 20:35:29 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/9725#comment:6 https://svn.boost.org/trac10/ticket/9725#comment:6 <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> Ticket