使用 clang-425.0.27 编译此代码片段(基于 LLVM3.2svn):
class CStorage
{};
typedef boost::shared_ptr< CStorage > AccessorPtr;
class CTest
{
public:
CTest( const CStorage &rAccessor )
: m_Accessor( rAccessor ){}
private:
AccessorPtr m_Accessor;
};
得到编译错误:
**error**: no matching constructor for initialization of 'AccessorPtr' (aka 'shared_ptr<CStorage>')
: m_Accessor( rAccessor ){}
**note**: candidate constructor (the implicit copy constructor) not viable: no known conversion from
'const FNPNS::TSM::CDirectBlockAccessor' to 'const boost::shared_ptr<FNPNS::TSM::CDirectBlockAccessor>' for 1st argument
template<class T> class shared_ptr