A copy constructor shall be declared for classes that contain pointers to data items
// NameDeclarator [ isPointer() ] [ $ptr_dcl := getParent() ] [ ancestor::ClassType [ getSemanticInfo() = $ptr_dcl ] [ not descendant::NameDeclarator [ isCopyConstructor() ] ] ]
1 class Matrix { 2 Matrix() 3 Matrix & operator = (const Matrix & other) 4 Matrix (Matrix &other) 5 private: 6 int *p; 7 int x[]; 8 }; 9 10 class X { 11 X() 12 private: 13 int *p; // MATCHES 14 int x[]; 15 }; 16 17 class Y { 18 Y() 19 Y & operator = (const Y & other) 20 private: 21 int *p; // MATCHES (2) 22 int x[]; 23 };