Boost C++ Libraries: Ticket #10684: Implicit conversion warnings when using clang's -Wconversion flag. https://svn.boost.org/trac10/ticket/10684 <p> Operating system: OS X 10.10 </p> <p> Compiler: </p> <pre class="wiki">$ clang++ --version Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) Target: x86_64-apple-darwin14.0.0 Thread model: posix $ </pre><p> Boost: 1.56.0 </p> <p> The following code (assumed to be in a file named clang_warning.cpp): </p> <div class="wiki-code"><div class="code"><pre><span class="c1">// clang_warning.cpp:</span> <span class="cp">#define BOOST_TEST_MODULE Test</span> <span class="cp">#include</span> <span class="cpf">&lt;boost/test/unit_test.hpp&gt;</span><span class="cp"></span> <span class="n">BOOST_AUTO_TEST_CASE</span><span class="p">(</span><span class="n">test</span><span class="p">)</span> <span class="p">{</span> <span class="n">BOOST_CHECK</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span> <span class="p">}</span> </pre></div></div><p> when compiled using the -Wconversion flag (and Boost under /opt/boost_1_56_0/) like: </p> <pre class="wiki"> $ clang++ -Wconversion -I/opt/boost_1_56_0/ clang_warning.cpp -lboost_test_exec_monitor </pre><p> gives implicit conversion warnings like: </p> <pre class="wiki"> /opt/boost_1_56_0/boost/test/utils/basic_cstring/bcs_char_traits.hpp:90:20: warning: implicit conversion changes signedness: 'long' to 'std::size_t' (aka 'unsigned long') [-Wsign-conversion] return ptr - cstr; ~~~~~~ ~~~~^~~~~~ </pre><pre class="wiki"> /opt/boost_1_56_0/boost/test/utils/basic_cstring/basic_cstring.hpp:232:18: warning: implicit conversion changes signedness: 'long' to 'size_type' (aka 'unsigned long') [-Wsign-conversion] return m_end - m_begin; ~~~~~~ ~~~~~~^~~~~~~~~ </pre><pre class="wiki"> /opt/boost_1_56_0/boost/test/utils/basic_cstring/io.hpp:55:50: warning: implicit conversion changes signedness: 'long' to 'size_type' (aka 'unsigned long') [-Wsign-conversion] os &lt;&lt; std::basic_string&lt;CharT1,Tr&gt;( beg, end - beg ); ~~~ ~~~~^~~~~ </pre><p> The full output is below: </p> <pre class="wiki">$ clang++ -Wconversion -I/opt/boost_1_56_0/ clang_warning.cpp -lboost_test_exec_monitor In file included from clang_warning.cpp:4: In file included from /opt/boost_1_56_0/boost/test/unit_test.hpp:19: In file included from /opt/boost_1_56_0/boost/test/test_tools.hpp:19: In file included from /opt/boost_1_56_0/boost/test/predicate_result.hpp:21: In file included from /opt/boost_1_56_0/boost/test/utils/basic_cstring/basic_cstring.hpp:21: /opt/boost_1_56_0/boost/test/utils/basic_cstring/bcs_char_traits.hpp:90:20: warning: implicit conversion changes signedness: 'long' to 'std::size_t' (aka 'unsigned long') [-Wsign-conversion] return ptr - cstr; ~~~~~~ ~~~~^~~~~~ /opt/boost_1_56_0/boost/test/utils/basic_cstring/basic_cstring.hpp:182:40: note: in instantiation of member function 'boost::unit_test::ut_detail::bcs_char_traits_impl&lt;const char&gt;::length' requested here , m_end ( m_begin + (s ? traits_type::length( s ) : 0 ) ) ^ /opt/boost_1_56_0/boost/test/unit_test_suite_impl.hpp:158:41: note: in instantiation of member function 'boost::unit_test::basic_cstring&lt;const char&gt;::basic_cstring' requested here master_test_suite_t() : test_suite( "Master Test Suite" ) ^ In file included from clang_warning.cpp:4: In file included from /opt/boost_1_56_0/boost/test/unit_test.hpp:19: In file included from /opt/boost_1_56_0/boost/test/test_tools.hpp:19: In file included from /opt/boost_1_56_0/boost/test/predicate_result.hpp:21: /opt/boost_1_56_0/boost/test/utils/basic_cstring/basic_cstring.hpp:232:18: warning: implicit conversion changes signedness: 'long' to 'size_type' (aka 'unsigned long') [-Wsign-conversion] return m_end - m_begin; ~~~~~~ ~~~~~~^~~~~~~~~ /opt/boost_1_56_0/boost/test/framework.hpp:90:86: note: in instantiation of member function 'boost::unit_test::basic_cstring&lt;const char&gt;::size' requested here internal_error( const_string m ) : std::runtime_error( std::string( m.begin(), m.size() ) ) {} ^ In file included from clang_warning.cpp:4: In file included from /opt/boost_1_56_0/boost/test/unit_test.hpp:19: In file included from /opt/boost_1_56_0/boost/test/test_tools.hpp:28: /opt/boost_1_56_0/boost/test/utils/basic_cstring/io.hpp:55:50: warning: implicit conversion changes signedness: 'long' to 'size_type' (aka 'unsigned long') [-Wsign-conversion] os &lt;&lt; std::basic_string&lt;CharT1,Tr&gt;( beg, end - beg ); ~~~ ~~~~^~~~~ /opt/boost_1_56_0/boost/test/utils/lazy_ostream.hpp:74:29: note: in instantiation of function template specialization 'boost::unit_test::operator&lt;&lt;&lt;char, std::__1::char_traits&lt;char&gt;, const char&gt;' requested here return m_prev(ostr) &lt;&lt; m_value; ^ clang_warning.cpp:8:5: note: in instantiation of member function 'boost::unit_test::lazy_ostream_impl&lt;const boost::unit_test::basic_cstring&lt;const char&gt; &amp;&gt;::operator()' requested here BOOST_CHECK(true); ^ /opt/boost_1_56_0/boost/test/test_tools.hpp:110:45: note: expanded from macro 'BOOST_CHECK' #define BOOST_CHECK( P ) BOOST_CHECK_IMPL( (P), BOOST_TEST_STRINGIZE( P ), CHECK, CHECK_PRED ) ^ /opt/boost_1_56_0/boost/test/test_tools.hpp:91:5: note: expanded from macro 'BOOST_CHECK_IMPL' BOOST_TEST_TOOL_IMPL( check_impl, P, check_descr, TL, CT ), 0 );\ ^ /opt/boost_1_56_0/boost/test/test_tools.hpp:79:9: note: expanded from macro 'BOOST_TEST_TOOL_IMPL' ::boost::unit_test::lazy_ostream::instance() &lt;&lt; check_descr, \ ^ 3 warnings generated. $ </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10684 Trac 1.4.3 Gennadiy Rozental Tue, 07 Jul 2015 21:43:21 GMT status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/10684#comment:1 https://svn.boost.org/trac10/ticket/10684#comment:1 <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> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.59.0</span> </li> </ul> Ticket