Search code examples
c++static-analysisrule-of-three

Are there any static analysis tools that check for Rule of 3 (or Rule of 5 C++11)


I am currently working on a codebase that is built on a foundation of sand.

There are numerous classes in supposedly tested libraries that violate the "Rule of 3". Most declare a non-trivial destructor, but are missing either a copy constructor or assignment operator.

Are there any compiler flags (gcc) or static analysis tools that warn when a class violates the rule of 3?

Currently we are using Coverity with GCC version 4.4.


Solution

  • Coverity has. We use version 6.5. There is a checker MISSING_COPY_OR_ASSIGN.