Main Content
Object Oriented Defects
Defects related to C++ object-oriented programming such as class design issues or issues in the inheritance hierarchy
These defects are related to the object-oriented aspect of C++ programming. The defects highlight class design issues or issues in the inheritance hierarchy. The defects include:
Data member not initialized or incorrectly initialized in constructor
Incorrect overriding of base class methods
Breaking of data encapsulation
Polyspace Results
*this not returned in copy assignment operator | operator= method does not return a
pointer to the current object |
Base class assignment operator not called | Copy assignment operator does not call copy assignment operators of base subobjects |
Base class destructor not virtual | Class cannot behave polymorphically for deletion of derived class objects |
Bytewise operations on nontrivial class object | Value representations may be improperly initialized or compared |
Conversion or deletion of incomplete class pointer | You delete or cast to a pointer to an incomplete class |
Copy constructor or assignment operator modifying source operand | Copy operation modifies data member of source object |
Copy constructor not called in initialization list | Copy constructor does not call copy constructors of some members or base classes |
Incompatible types prevent overriding | Derived class method hides a virtual base
class method instead of overriding it |
Lambda used as typeid operand | typeid is used on lambda expression |
Member not initialized in constructor | Constructor does not initialize some members of a class |
Missing explicit keyword | Constructor or user-defined conversion operator missing the explicit
specifier |
Missing virtual inheritance | A base class is inherited virtually and nonvirtually in the same hierarchy |
Object slicing | Derived class object passed by value to function with base class parameter |
Operator new not overloaded for possibly overaligned class | Allocated storage might be smaller than object alignment requirement |
Partial override of overloaded virtual functions | Class overrides fraction of inherited virtual functions with a given name |
Return of non const handle to encapsulated data member | Method returns pointer or reference to internal member of object |
Self assignment not tested in operator | Copy assignment operator does not test for self-assignment |
Topics
- Bug Finder Defect Groups
The Bug Finder defect checkers are classified into groups such as data flow, concurrency, numerical, and so on.