title: Isn't C++'s inline totally optional?
body: <p>I have a class that had an inline member, but I later decided that I wanted to remove the implementation from the headers so I moved the members body of the functions out to a cpp file. At first I just left the inlined signature in the header file (sloppy me) and the program failed to link correctly. Then I fixed my header and it all works fine, of course.</p>
  
  <p><em>But wasn't inline totally optional?</em></p>
  
  <p>In code:</p>
  
  <p>First:</p>
  
  <pre><code>//Class.h
  class MyClass
  {
     void inline foo()
     {}
  };
  </code></pre>
  
  <p>Next changed to (won't link):</p>
  
  <pre><code>//Class.h
  class MyClass
  {
     void inline foo();
  };
  
  //Class.cpp
  void MyClass::foo()
  {}
  </code></pre>
  
  <p>And then to (will work fine):</p>
  
  <pre><code>//Class.h
  class MyClass
  {
     void foo();
  };
  
  //Class.cpp
  void MyClass::foo()
  {}
  </code></pre>
  
  <p>I thought inline was optional, and imagined I might get by with a warning for my sloppiness, but didn't expect a linking error. What's the correct/standard thing a compiler should do in this case, did I deserve my error according to the standard?</p>