Given the following C++ code class K { public: void f(); void g();
private: int * a; double * b; float * c; unsigned int * d; }; void K :: f() { a = new int; b = new double [ 10]; delete c; delete [] d; } void K :: g() { delete [] a; // error delete b; // error c = new float [ 20]; // error d = new unsigned int; // error } Recent snapshot g++ 4.3 20070803 can't find anything wrong with the code. Suggest enhance compiler to track use of plain new/delete and array new/delete and warn where possible to detect an error. Manual memory allocation and de-allocation is enough of a pain in C++ without total silence from the compiler. -- Summary: add checking for array new & delete Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dcb314 at hotmail dot com GCC host triplet: x86_64-suse-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32984