#include<memory>classMyClass{classMyClassPrivateData{public:intm_member;MyClassPrivateData&operator=(constMyClassPrivateData&priv){this->m_member=priv.m_member;return*this;}};std::unique_ptr<MyClassPrivateData>m_data;public:MyClass():m_data(newMyClassPrivateData()){}MyClass(constMyClass&)=delete;// warning : Member variable 'MyClass::m_data' is not assigned a value in 'MyClass::operator='.MyClass&operator=(constMyClass&time){if(&time!=this){(*m_data)=*(time.m_data);}return*this;}};
It is intended not to set m_data, as it's a unique_ptr( would be the same if being a raw pointer), Value pointed is assigned, not pointer itself
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It is intended not to set m_data, as it's a unique_ptr( would be the same if being a raw pointer), Value pointed is assigned, not pointer itself
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/13203