[C++-sig] Complaint about missing call policies, when they are in fact specified

Roman Yakovenko roman.yakovenko at gmail.com
Tue Dec 20 08:40:51 CET 2011


On Mon, Dec 19, 2011 at 9:01 PM, Davidson, Josh <josh.davidson at lmco.com> wrote:
> I'm adding return value call policies to methods of a class as follows:
>        mb.class_("SerialStore").member_functions(lambda decl: decl.name.startswith("getSim")).call_policies = \
>            call_policies.return_internal_reference()
>
> --------------------------------------------------------------------------------------------------------------------------
>
> During generation, I get the following warning:
> WARNING: boost::container::list<unsigned char,boost::interprocess::allocator<unsigned char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ull>, boost::interprocess::iset_index> > > * SerialStore::getSimicsInput() [member function]
>
>> compilation error W1050: The function returns
>
>> "boost::container::list<unsigned
>
>> char,boost::interprocess::allocator<unsigned char,
>
>> boost::interprocess::segment_manager<char, boost::interprocess::rbtree
>
>> _best_fit<boost::interprocess::mutex_family,
>
>> boost::interprocess::offset_ptr<void>, 0ull>,
>
>> boost::interprocess::iset_index> > > *" type. You have to specify a
>
>> call policies.Be sure to take a look on `Py++` defined call policies
>
> --------------------------------------------------------------------------------------------------------------------------
>
> Here is the generated code for that method that appears to have the call policy specified:
>        { //::SerialStore::getSimicsInput
>
>            typedef ::boost::container::list<unsigned char,boost::interprocess::allocator<unsigned char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void>, 0ull>, boost::interprocess::iset_index> > > * ( ::SerialStore::*getSimicsInput_function_type )(  ) ;
>
>            SerialStore_exposer.def(
>                "getSimicsInput"
>                , getSimicsInput_function_type( &::SerialStore::getSimicsInput )
>                , bp::return_internal_reference< >() );
>
>        }

Please open a bug on sorceforge with the source code to reproduce it.
Meanwhile, py++ provides functionality to disable warnings ( for the
concrete declaration ) - just use it.

Roman


More information about the Cplusplus-sig mailing list