Boost C++ Libraries: Ticket #10026: Building Boost with #define BOOST_SP_ENABLE_DEBUG_HOOKS generates compile error C2665 in Visual C++ 2012 https://svn.boost.org/trac10/ticket/10026 <p> I ran the following command from a Visual C++ command window. </p> <p> b2 toolset=msvc-11.0 address-model=32 variant=debug link=static threading=multi runtime-link=shared --build-type=complete define=BOOST_SP_ENABLE_DEBUG_HOOKS </p> <p> I am trying to compile the Boost Libraries with the debug hooks in. Is this a Visual C++ 2012 compiler issue as I also had problems with compilation on Visual C++ 2010. Any ideas? Thanks. I have tried this compilation on both Windows 7 and Windows 8.1. </p> <p> compile-c-c++ bin.v2\libs\thread\build\msvc-11.0\release\address-model-32\link-static\threading-multi\win32\thread.obj thread.cpp .\boost/smart_ptr/detail/sp_counted_impl.hpp(69) : error C2665: 'boost::sp_scalar_constructor_hook' : none of the 2 overloads could convert all the argument types </p> <blockquote> <p> .\boost/smart_ptr/detail/sp_counted_impl.hpp(45): could be 'void boost::sp_scalar_constructor_hook(void *,size_t,void *)' while trying to match the argument list '(const boost::exception_detail::clone_base *, unsigned int, boost::detail::sp_counted_impl_p&lt;X&gt; *const )' with [ </p> <blockquote> <p> X=const boost::exception_detail::clone_base </p> </blockquote> <p> ] .\boost/smart_ptr/detail/sp_counted_impl.hpp(66) : while compiling class template member function 'boost::detail::sp_counted_impl_p&lt;X&gt;::sp_counted_impl_p(X *)' with [ </p> <blockquote> <p> X=const boost::exception_detail::clone_base </p> </blockquote> <p> ] .\boost/smart_ptr/detail/shared_count.hpp(130) : see reference to function template instantiation 'boost::detail::sp_counted_impl_p&lt;X&gt;::sp_counted_impl_p(X *)' being compiled with [ </p> <blockquote> <p> X=const boost::exception_detail::clone_base </p> </blockquote> <p> ] .\boost/smart_ptr/detail/shared_count.hpp(130) : see reference to class template instantiation 'boost::detail::sp_counted_impl_p&lt;X&gt;' being compiled with [ </p> <blockquote> <p> X=const boost::exception_detail::clone_base </p> </blockquote> <p> ] .\boost/smart_ptr/shared_ptr.hpp(276) : see reference to function template instantiation 'boost::detail::shared_count::shared_count&lt;Y&gt;(Y *)' being compiled with [ </p> <blockquote> <p> Y=const boost::exception_detail::clone_base </p> </blockquote> <p> ] .\boost/smart_ptr/shared_ptr.hpp(354) : see reference to function template instantiation 'void boost::detail::sp_pointer_construct&lt;const boost::exception_detail::clone_base,Y&gt;(boost::shared_ptr&lt;T&gt; *,Y *,boost::detail::shared_count &amp;)' being compiled with [ </p> <blockquote> <p> Y=const boost::exception_detail::clone_base, T=const boost::exception_detail::clone_base </p> </blockquote> <p> ] .\boost/exception/detail/exception_ptr.hpp(313) : see reference to function template instantiation 'boost::shared_ptr&lt;T&gt;::shared_ptr&lt;const boost::exception_detail::clone_base&gt;(Y *)' being compiled with [ </p> <blockquote> <p> T=const boost::exception_detail::clone_base, Y=const boost::exception_detail::clone_base </p> </blockquote> <p> ] .\boost/exception/detail/exception_ptr.hpp(313) : see reference to function template instantiation 'boost::shared_ptr&lt;T&gt;::shared_ptr&lt;const boost::exception_detail::clone_base&gt;(Y *)' being compiled with [ </p> <blockquote> <p> T=const boost::exception_detail::clone_base, Y=const boost::exception_detail::clone_base </p> </blockquote> <p> ] </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10026 Trac 1.4.3 tm@… Fri, 15 Aug 2014 12:48:17 GMT cc set https://svn.boost.org/trac10/ticket/10026#comment:1 https://svn.boost.org/trac10/ticket/10026#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">tm@…</span> added </li> </ul> <p> Also seen similar behavior in our codebase: </p> <pre class="wiki">[58/1477] CXX 3rdParty/Boost/src/libs/program_options/src/options_description.o FAILED: /Users/tobias/llvm/bin/clang++ -MMD -MF 3rdParty/Boost/src/libs/program_options/src/options_description.o.d -c -O0 -fsanitize=address -fno-omit-frame-pointer -DBOOST_SP_ENABLE_DEBUG_HOOKS -DBOOST_SIGNALS_NO_DEPRECATION_WARNING -g -isystem /Users/tobias/dev/rep/swift-work-clean/3rdParty/Boost/src -DSWIFT_EXPERIMENTAL_FT -DSWIFT_EXPERIMENTAL_HISTORY -DSWIFT_EXPERIMENTAL_WB -DBOOST_ALL_NO_LIB -DBOOST_SYSTEM_NO_DEPRECATED -I. -c 3rdParty/Boost/src/libs/program_options/src/options_description.cpp -o 3rdParty/Boost/src/libs/program_options/src/options_description.o In file included from 3rdParty/Boost/src/libs/program_options/src/options_description.cpp:10: In file included from /Users/tobias/dev/rep/swift-work-clean/3rdParty/Boost/src/boost/program_options/options_description.hpp:16: In file included from /Users/tobias/dev/rep/swift-work-clean/3rdParty/Boost/src/boost/shared_ptr.hpp:17: In file included from /Users/tobias/dev/rep/swift-work-clean/3rdParty/Boost/src/boost/smart_ptr/shared_ptr.hpp:32: In file included from /Users/tobias/dev/rep/swift-work-clean/3rdParty/Boost/src/boost/smart_ptr/detail/shared_count.hpp:30: /Users/tobias/dev/rep/swift-work-clean/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_impl.hpp:69:44: error: cannot initialize a parameter of type 'void *' with an lvalue of type 'const boost::program_options::value_semantic *' boost::sp_scalar_constructor_hook( px, sizeof(X), this ); ^~ /Users/tobias/dev/rep/swift-work-clean/3rdParty/Boost/src/boost/smart_ptr/detail/shared_count.hpp:91:23: note: in instantiation of member function 'boost::detail::sp_counted_impl_p&lt;const boost::program_options::value_semantic&gt;::sp_counted_impl_p' requested here pi_ = new sp_counted_impl_p&lt;Y&gt;( p ); ^ /Users/tobias/dev/rep/swift-work-clean/3rdParty/Boost/src/boost/smart_ptr/shared_ptr.hpp:183:44: note: in instantiation of function template specialization 'boost::detail::shared_count::shared_count&lt;const boost::program_options::value_semantic&gt;' requested here explicit shared_ptr( Y * p ): px( p ), pn( p ) // Y must be complete ^ 3rdParty/Boost/src/libs/program_options/src/options_description.cpp:54:7: note: in instantiation of function template specialization 'boost::shared_ptr&lt;const boost::program_options::value_semantic&gt;::shared_ptr&lt;const boost::program_options::value_semantic&gt;' requested here : m_value_semantic(s) ^ /Users/tobias/dev/rep/swift-work-clean/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_impl.hpp:45:41: note: passing argument to parameter 'px' here void sp_scalar_constructor_hook( void * px, std::size_t size, void * pn ); ^ 1 error generated. [58/1477] CXX 3rdParty/Boost/src/libs/program_options/src/value_semantic.o ninja: build stopped: subcommand failed. </pre> Ticket viboes Fri, 13 Feb 2015 18:50:07 GMT component changed; owner set https://svn.boost.org/trac10/ticket/10026#comment:2 https://svn.boost.org/trac10/ticket/10026#comment:2 <ul> <li><strong>owner</strong> set to <span class="trac-author">Peter Dimov</span> </li> <li><strong>component</strong> <span class="trac-field-old">Building Boost</span> → <span class="trac-field-new">smart_ptr</span> </li> </ul> Ticket