title: inline meaning in module interfaces
body: <p>Consider the header file:</p>
  
  <pre><code>class T
  {
  private:
    int const ID;
  
  public:
    explicit T(int const ID_) noexcept : ID(ID_) {}
  
    int GetID() const noexcept { return ID; }
  };
  </code></pre>
  
  <p>or, alternatively:</p>
  
  <pre><code>class T
  {
  private:
    int const ID;
  
  public:
    explicit T(int const ID_) noexcept;
  
    int GetID() const noexcept;
  };
  
  inline T::T(int const ID_) noexcept : ID(ID_) {}
  
  inline int T::GetID() const noexcept { return ID; }
  </code></pre>
  
  <p>In a pre-modules world, these headers might be textually included in multiple TU without ODR violations. Furthermore, since the involved member functions are relatively small, the compiler would likely "inline" (avoid function calls when using) those functions, or even optimize away some instances of <code>T</code> altogether.</p>
  
  <p>In a recent <a href="https://www.reddit.com/r/cpp/comments/f47x4o/202002_prague_iso_c_committee_trip_report_c20_is/" rel="noreferrer">report</a> on the meeting where C++20 was finished, I could read the following statement:</p>
  
  <blockquote>
    <p>We clarified the meaning of <code>inline</code> in module interfaces: the intent is that bodies of functions that are not explicitly declared <code>inline</code> are not part of the ABI of a module, even if those function bodies appear in the module interface. In order to give module authors more control over their ABI, member functions defined in class bodies in module interfaces are no longer implicitly <code>inline</code>.</p>
  </blockquote>
  
  <p>I'm not sure I'm not mistaken that. Does that mean that, in a modules world, for the compiler to be able to optimize away function calls we have to annotate them as <code>inline</code> even if they are defined in-class?</p>
  
  <p>If so, would the following module interface be equivalent to the headers above?</p>
  
  <pre><code>export module M;
  
  export
  class T
  {
  private:
    int const ID;
  
  public:
    inline explicit T(int const ID_) noexcept : ID(ID_) {}
  
    inline int GetID() const noexcept { return ID; }
  };
  </code></pre>
  
  <p>Even though I still don't have a compiler with modules support, I would like to start using <code>inline</code> like so when appropriate, to minimize future refactoring.</p>