title: C++11: g++-4.7 internal compiler error
body: <p>The following code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;array&gt;
  using namespace std;
  
  constexpr int N = 1000000;
  constexpr int f(int x) { return x*2; }
  
  typedef array&lt;int, N&gt; A;
  
  template&lt;int... i&gt; struct F { static constexpr A f() { return A{{ ::f(i)... }}; } };
  
  template&lt;class A, class B&gt; struct C {};
  template&lt;int... i, int... j&gt; struct C&lt;F&lt;i...&gt;, F&lt;j...&gt;&gt; : F&lt;i..., (sizeof...(i)+j)...&gt;
  {
          using T = F&lt;i..., (sizeof...(i)+j)...&gt;;
  };
  
  template&lt;int n&gt; struct S : C&lt;typename S&lt;n/2&gt;::T, typename S&lt;n-n/2&gt;::T&gt; {};
  template&lt;&gt; struct S&lt;1&gt; : F&lt;0&gt; { using T = F&lt;0&gt;; };
  
  constexpr auto X = S&lt;N&gt;::f();
  
  int main()
  {
          cout &lt;&lt; X[3] &lt;&lt; endl;
  }
  </code></pre>
  
  <p>Produces an internal compiler error in GCC 4.7 in <code>-std=gnu++11</code> mode.</p>
  
  <pre><code>$ g++ -std=gnu++11 test.cpp
  g++-4.7.real: internal compiler error: Killed (program cc1plus)
  </code></pre>
  
  <p>What is going wrong?</p>