Confusion about in-class initialization of static data members
<p>I'm reading lippman's c++ primer where on p. 303 they give this:</p>

<pre><code>class Account {
private:
  static constexpr int period = 30;
  double daily_tbl[period];
}
</code></pre>

<blockquote>
  <p>If the member is used only in contexts where the compiler can substitute the member's value, then an initialized const or constexpr static need not be separately defined. However, if we use the member in a context in which the value cannot be substituted, then there must be a definition for that member.</p>
</blockquote>

<p>Also:</p>

<blockquote>
  <p>For example, if we pass Account::period to a function that takes a const int&amp;, then period must be defined.</p>
</blockquote>

<p>So I tried adding such a function:</p>

<pre><code>class Account {
private:
  static constexpr int period = 30;
  double daily_tbl[period];

  void foo(const int &amp;i) { ; }
  void bar() { foo(period); } //no error?
};
</code></pre>

<p>There I have added a function that takes a const int&amp;. I also did not add any definition for the period variable. But still I get no error, as they said I should get. Why not?</p>
