title: Simple vector initialization in C++11 returns weird error
body: <p>Compiling this piece of code:</p>
  
  <pre><code>#include &lt;vector&gt;
  
  long long sumOfMedians(int seed, int mul, int add, int N, int K)
  {
    std::vector&lt;int&gt; nos{N+2,0};
    for(int i=0; i&lt;N; i++)
      {
        if(i == 0)
      nos[i] = seed;
        else
      nos[i] = (nos[i-1]*mul + add)%65536;
      }
  }
  
  int main()
  {
    sumOfMedians(3,1,1,10,3);
    return 0;
  }
  </code></pre>
  
  <p>causes an error</p>
  
  <pre><code>*** Error in `./a.out': free(): invalid next size (fast): 0x00000000006e8010 ***
  [2]    31743 abort (core dumped)  ./a.out
  </code></pre>
  
  <p>While slightly changing the vector initialization line (line 5 in previous code) to (line 5,6 in new code)</p>
  
  <pre><code>#include &lt;vector&gt;
  
  long long sumOfMedians(int seed, int mul, int add, int N, int K)
  {
    std::vector&lt;int&gt; nos;
    nos.resize(N+2,0);
    for(int i=0; i&lt;N; i++)
      {
        if(i == 0)
      nos[i] = seed;
        else
      nos[i] = (nos[i-1]*mul + add)%65536;
      }
  }
  
  int main()
  {
    sumOfMedians(3,1,1,10,3);
    return 0;
  }
  </code></pre>
  
  <p>Causes it to compile successfully. What gives?</p>
  
  <p>g++ parameter: -std=c++11</p>