[cfe-dev] c++-analyzer warning question
Dave Flogeras via cfe-dev
cfe-dev at lists.llvm.org
Tue Sep 20 18:05:33 PDT 2016
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.
I have put the code for a toy example here
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:
- Install CMake if needed, I'm using 3.5.2
- Clone the repo
- Inside the repo make a build dir for out of tree building, ie.
- from within build/ run "CXX=c++-analyzer cmake ..
- once finished, run make
You'll (hopefully) see it generate the warning like
warning: Potential memory leak
My question is, is this a proper warning? Are you not allowed to
implicitly upcast a smart_ptr from the return of operator= ?
Thanks for any help, and sorry for any ignorance.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev