title: What does static for operator new mean
body: <p>what does static for operator new mean here? what would happen if i put it in a header file?</p>
  
  <pre><code>static void* operator new(size_t size, std::string s)
  {
      return 0;
  }
  
  int main() 
  {
      return 0;
  }
  </code></pre>
  
  <p>This code compiles on visual studio 2013</p>
  
  <p>But gcc gives an error</p>
  
  <blockquote>
    <p>error: 'void* operator new(size_t)' may not be declared
    as static</p>
    
    <p>static void* operator new(size_t size)</p>
  </blockquote>
  
  <p>And so does clang</p>
  
  <blockquote>
    <p>error: static declaration of 'operator new' follows non-static
    declaration</p>
    
    <p>static void* operator new(size_t size)</p>
  </blockquote>
  
  <p>Is this a gray area in c++, or is visual studio being generous?</p>
  
  <p>link to the code: <a href="https://www.ideone.com/kZmWgf" rel="nofollow noreferrer">https://www.ideone.com/kZmWgf</a></p>