[Bug c++/35086] New: operator new may not be declared within a namespace
gilad at odinak dot com
gcc-bugzilla@gcc.gnu.org
Tue Feb 5 07:08:00 GMT 2008
The below code snippet compiles on gcc 3.4.6
gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-8)
but fails on gcc 4.1.1
gcc-4.1.1 (GCC) 4.1.1 20060724 (prerelease) (4.1.1-4pclos2007)
with erros such as
namespace_operator_new.cpp:8: error: Âvoid* my_alloc::operator new(size_t,
char*, int)Â may not be declared within a namespace
-------------- namespace_operator_new.cpp --------------------------------
#include <new>
using std::bad_alloc;
using std::nothrow_t;
namespace my_alloc {
void * operator new(size_t s, char *file, int line) throw (bad_alloc);
void* operator new[](size_t s, char *file, int line) throw(bad_alloc);
void operator delete(void *p) throw();
void operator delete[](void *p) throw();
}
using namespace my_alloc;
-----------------------------------
compiled with
gcc -g -O2 -Wno-deprecated -Wall -Werror -c namespace_operator_new.cpp
--
Summary: operator new may not be declared within a namespace
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gilad at odinak dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35086
More information about the Gcc-bugs
mailing list