title: Member function with static linkage
body: <p>I'm trying to understand why the following is an error:</p>
  
  <pre><code>class Foobar {
   public:
    static void do_something();
  };
  
  static void Foobar::do_something() {} // Error!
  
  int main() {
    Foobar::do_something();
  }
  </code></pre>
  
  <p>This errors with "error: cannot declare member function 'static void Foobar::do_something()' to have static linkage" in g++, and "error: 'static' can only be specified inside the class definition" in clang++.</p>
  
  <p>I understand that the way to fix this is to remove "static" in the definition of do_something on line 6. I don't, however, understand why this is an issue. Is it a mundane reason, such as "the C++ grammar dictates so", or is something more complicated going on?</p>