namespace X
{
void* operator new (size_t);
}
gives error message as:
error: ‘void* X::operator new(size_t)’ may not be declared w
@Sharptooth's Answer makes more sense if we consider this section from the standard:
3.7.3.1 Allocation functions [basic.stc.dynamic.allocation]
[..] An allocation function shall be a class member function or a global function; a program is ill-formed if an allocation function is declared in a namespace scope other than global scope or declared static in global scope. [..]
The above limitation is probably imposed for the very reason that @sharptooth's answer points out.