The following C++ program should not compile: #include <new> class C { public: void * operator new (size_t = 32); // invalid };
The C++ standard, clause 3.7.3.1, paragraph 1, says that the first parameter to new should not have a default argument. GCC gives no error and no warning. -- Summary: new operator should not permit default first parameter Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: andrew dot stubbs at st dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31988