Boost C++ Libraries: Ticket #770: static assert for boost::python::make_constructor https://svn.boost.org/trac10/ticket/770 <pre class="wiki">You get a static assertion when using boost::python::make_constructor together with the call policy return_value_policy&lt;manage_new_object&gt;() Test case: ===================================================== #include &lt;boost/python.hpp&gt; namespace Test { using namespace boost::python; class Foo { }; Foo *fooCreator() { return new Foo(); } BOOST_PYTHON_MODULE(Test) { class_&lt;Foo&gt;("Foo") .def("__init__", make_constructor(fooCreator, return_value_policy&lt;manage_new_object&gt;())); } } /* namespace Test */ Failure: ===================================================== /usr/include/boost/python/make_constructor.hpp: In instantiation of `boost::python::detail::constructor_policy&lt;boost::python::return_value_policy&lt;boost::python::manage_new_object, boost::python::default_call_policies&gt; &gt;': /usr/include/boost/python/make_constructor.hpp:150: instantiated from `boost::python::api::object boost::python::detail::make_constructor_aux(F, const CallPolicies&amp;, const Sig&amp;) [with F = Test::Foo*(*)(), CallPolicies = boost::python::return_value_policy&lt;boost::python::manage_new_object, boost::python::default_call_policies&gt;, Sig = boost::mpl::vector1&lt;Test::Foo*&gt;]' /usr/include/boost/python/make_constructor.hpp:236: instantiated from `boost::python::api::object boost::python::make_constructor(F, const CallPolicies&amp;) [with F = Test::Foo*(*)(), CallPolicies = boost::python::return_value_policy&lt;boost::python::manage_new_object, boost::python::default_call_policies&gt;]' boost-python-test.cpp:14: instantiated from here /usr/include/boost/python/make_constructor.hpp:106: error: incomplete type ` boost::STATIC_ASSERTION_FAILURE&lt;false&gt;' does not have member `value' Expected Result: ===================================================== Should compile </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/770 Trac 1.4.3 david_abrahams Fri, 03 Nov 2006 16:28:15 GMT status changed https://svn.boost.org/trac10/ticket/770#comment:1 https://svn.boost.org/trac10/ticket/770#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=52572 That's the expected behavior. make_constructor supplies its own return value policy that does the right thing, and the assertion exists to let you know that any return value policy you supply will be ignored. Admittedly the error message could be better, but we didn't have the technology to make that improvement when the code was written. </pre> Ticket