title: Using numeric_limits::max() in constant expressions
body: <p>I would like to define inside a class a constant which value is the maximum possible int. Something like this:</p>
  
  <pre><code>class A
  {
      ...
      static const int ERROR_VALUE = std::numeric_limits&lt;int&gt;::max();
      ...
  }
  </code></pre>
  
  <p>This declaration fails to compile with the following message:</p>
  
  <blockquote>
    <p>numeric.cpp:8: error: 'std::numeric_limits::max()' cannot appear in a constant-expression
    numeric.cpp:8: error: a function call cannot appear in a constant-expression</p>
  </blockquote>
  
  <p>I understand why this doesn't work, but two things look weird to me:</p>
  
  <ol>
  <li><p>It seems to me a natural decision to use the value in constant expressions. Why did the language designers decide to make <em>max()</em> a function thus not allowing this usage?</p></li>
  <li><p>The spec claims in 18.2.1 that</p>
  
  <blockquote>
    <p>For all members declared static const in the numeric_limits template, specializations shall define these values in such a way that they are usable as integral constant expressions.</p>
  </blockquote>
  
  <p>Doesn't it mean that I should be able to use it in my scenario and doesn't it contradict the error message?</p></li>
  </ol>
  
  <p>Thank you. </p>