id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 12019,Conversion from unique_ptr to shared_ptr is too broad,Tavian Barnes ,Peter Dimov,"The following program doesn't compile because the foo overload is ambiguous. This applies if boost::movelib::unique_ptr is used as well. It works if std::shared_ptr is used instead of boost::shared_ptr. $ cat foo.cpp #include #include using boost::shared_ptr; using std::unique_ptr; using std::make_unique; template class Provider { }; template void foo(shared_ptr ptr) { } template void foo(unique_ptr> ptr) { } class IntProvider : public Provider { }; void bar() { foo(make_unique()); } $ g++ -std=c++14 -c foo.cpp foo.cpp: In function ‘void bar()’: foo.cpp:24:38: error: call of overloaded ‘foo(std::_MakeUniq::__single_object)’ is ambiguous foo(make_unique()); ^ foo.cpp:13:6: note: candidate: void foo(boost::shared_ptr) [with T = int] void foo(shared_ptr ptr) ^ foo.cpp:17:6: note: candidate: void foo(std::unique_ptr >) [with T = int] void foo(unique_ptr> ptr) The boost::shared_ptr taking unique_ptr should be SFINAE'd away when unique_ptr::pointer isn't convertible to T*. The std::shared_ptr DR is #2399: http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2399",Bugs,new,To Be Determined,smart_ptr,Boost 1.60.0,Problem,,,