title: Compile-time array constants
body: <p>I seem to be missing something rather fundamental.
  I'm trying to use const array members at compile-time.</p>
  
  <pre><code>const int list[3] = { 2, 5, 7 };
  const int a = list[2]; // this doesn't error?
  
  template&lt;int N1, int N2&gt;
  struct tmax {
    enum { value = ((N1 &gt; N2) ? N1 : N2) };
  };
  
  const int b = tmax&lt;2,4&gt;::value;
  const int c = tmax&lt;list[0],list[1]&gt;::value; // error is here
  
  int main()
  {
    return 0;
  }
  </code></pre>
  
  <p>Errors:</p>
  
  <pre><code>prog.cpp:10:24: error: 'list' cannot appear in a constant-expression
  prog.cpp:10:30: error: an array reference cannot appear in a constant-expression
  </code></pre>
  
  <p>Here is the <a href="http://ideone.com/Iuk1r" rel="noreferrer" title="relevent IDEOne link">relevent IDEOne link</a></p>
  
  <p>So why doesn't this work? What am I missing? What should I do differently?</p>