#include <boost/interprocess/smart_ptr/unique_ptr.hpp>
using namespace boost::interprocess;
struct poly_deleter
{
template<typename T>
void operator()(T *p)
{
delete p;
}
};
typedef unique_ptr<int, poly_deleter> u_ptr;
u_ptr func()
{
return u_ptr();
}
int main()
{
u_ptr u;
u = func();
}
I2luY2x1ZGUgPGJvb3N0L2ludGVycHJvY2Vzcy9zbWFydF9wdHIvdW5pcXVlX3B0ci5ocHA+CnVzaW5nIG5hbWVzcGFjZSBib29zdDo6aW50ZXJwcm9jZXNzOwoKc3RydWN0IHBvbHlfZGVsZXRlcgp7CiAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBUPgoJdm9pZCBvcGVyYXRvcigpKFQgKnApCgl7CgkJZGVsZXRlIHA7Cgl9Cn07Cgp0eXBlZGVmIHVuaXF1ZV9wdHI8aW50LCBwb2x5X2RlbGV0ZXI+IHVfcHRyOwoKdV9wdHIgZnVuYygpCnsKCXJldHVybiB1X3B0cigpOwp9CgppbnQgbWFpbigpCnsKCXVfcHRyIHU7Cgl1ID0gZnVuYygpOwp9Cg==
prog.cpp: In function ‘int main()’:
prog.cpp:23: error: ambiguous overload for ‘operator=’ in ‘u = func()()’
/usr/include/boost/interprocess/smart_ptr/unique_ptr.hpp:212: note: candidates are: boost::interprocess::unique_ptr<T, D>& boost::interprocess::unique_ptr<T, D>::operator=(boost::interprocess::rv<boost::interprocess::unique_ptr<T, D> >&) [with T = int, D = poly_deleter]
/usr/include/boost/interprocess/smart_ptr/unique_ptr.hpp:250: note: boost::interprocess::unique_ptr<T, D>& boost::interprocess::unique_ptr<T, D>::operator=(int boost::interprocess::unique_ptr<T, D>::nat::*) [with T = int, D = poly_deleter]