<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div>Hi, I have some code that generates a warning when passed through c++analyzer and I am wondering if someone can help me understand it.<br><br></div>I have put the code for a toy example here <a href="https://github.com/dflogeras/analyzer">https://github.com/dflogeras/analyzer</a><br><br></div>It uses CMake, I am building on (Gentoo) Linux using clang/LLVM 3.7.1 with GCC-4.9.3 headers.  You can build it by doing the following:<br></div>- Install CMake if needed, I'm using 3.5.2<br></div>- Clone the repo<br></div>- Inside the repo make a build dir for out of tree building, ie. path/to/analyzer/build<br></div>- from within build/ run "CXX=c++-analyzer cmake .. -DCMAKE_BUILD_TYPE=Release"<br></div>- once finished, run make<br><br></div>You'll (hopefully) see it generate the warning like<br><br>/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4/bits/unique_ptr.h:273:4: warning: Potential memory leak<br>          return *this;<br><br></div>My question is, is this a proper warning?  Are you not allowed to implicitly upcast a smart_ptr from the return of operator= ?<br><br></div>Thanks for any help, and sorry for any ignorance.<br></div>Dave<br></div>