id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 3022,Automatic conversion from Y* to boost::shared_ptr with std::pair,koelsch@…,Peter Dimov,"The assignment of std::pair to std::pair > compiles without warning and implicitly converts a Y* to a boost::shared_ptr. I guess this has to do with: template class shared_ptr { ... template typename boost::detail::sp_enable_if_auto_ptr< Ap, shared_ptr & >::type operator=( Ap r ) ... }; This behavior was witnessed under VC2005, VC2008, and gcc4.0.1. A minimal program demonstrating an evil consequence of this follows: int main() { int i = 2; boost::shared_ptr j( new int ); //boost::shared_ptr k = &*j; // does not compile //std::pair > v( i, &*j ); // does not compile std::pair > v = std::make_pair( i, &*j ); // However, this compiles // kabum } Regards, Tobias",Bugs,closed,,smart_ptr,Boost 1.39.0,Problem,invalid,implicit conversion shared_ptr,