title: operator new inside namespace
body: <pre><code>namespace X
  {
    void* operator new (size_t);
  }
  </code></pre>
  
  <p>gives error message as:</p>
  
  <pre><code>error: ‘void* X::operator new(size_t)’ may not be declared within a namespace
  </code></pre>
  
  <p>Is it a <a href="http://gcc.gnu.org/ml/gcc-bugs/2008-02/msg00712.html" rel="noreferrer">gcc compiler bug</a> ? In older gcc version it seems to be working.
  Any idea, why it's not allowed ?</p>
  
  <p><strong>Use case</strong>:
  I wanted to allow only custom <code>operator new/delete</code> for the classes and wanted to disallow global <code>new/operator</code>. Instead of linker error, it was easy to catch compiler error; so I coded:</p>
  
  <pre><code>namespace X {
    void* operator new (size_t);
  }
  using namespace X;
  </code></pre>
  
  <p>This worked for older version of gcc but not for the new one.</p>