title: constexpr function parameters as template arguments
body: <p>I am playing around with some toy code using c++11 to figure out a bit more about how things work. During this I came across the following issue that simplifies down to:</p>
  
  <pre><code>template &lt;int x, int y&gt;
  class add {
  public:
      static constexpr int ret = x + y;
  };
  
  constexpr int addFunc(const int x, const int y) {
      return add&lt;x,y&gt;::ret;
  }
  
  int main() {
      const int x = 1;
      const int y = 2;
      cout &lt;&lt; add&lt;x,y&gt;::ret &lt;&lt; endl; // Works
      cout &lt;&lt; addFunc(1,2) &lt;&lt; endl;  // Compiler error
      return 0;
  }
  </code></pre>
  
  <p>I'm using GCC 4.8.1 and the output is: <br />
  'x' is not a constant expression in template argument for type 'int' <br />
  'y' is not a constant expression in template argument for type 'int'</p>
  
  <p>What exactly is the difference between the two ways I am trying to calculate <code>add::ret</code>? Both of these values should be available at compile time. </p>