title: range based for loop with existing variable
body: <p>Using a range based for loop in C++11 with an existing variable, I would expect that variable to be filled with the value of the last iteration after the loop. However, I've gotten different results when I tested it.</p>
  
  <p>Example:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  using namespace std;
  
  int main() {
    std::vector&lt;int&gt; v;
    v.push_back(2);
    v.push_back(43);
    v.push_back(99);
  
    int last = -50;
    for (last : v)
      std::cout &lt;&lt; ":" &lt;&lt; last &lt;&lt; "\n";
  
    std::cout &lt;&lt; last;
    return 0;
  }
  </code></pre>
  
  <ol>
  <li>MSVC 2013 doesn't seem to support range based for loops without type declaration</li>
  <li><p>GCC-5.1 either automatically introduces a new variable or sets it back to the initial value, giving</p>
  
  <blockquote>
    <p>:2<br>
    :43<br>
    :99<br>
    -50</p>
  </blockquote></li>
  </ol>
  
  <p>I guess MSVC is just being MSVC again, but what about GCC here? Why is <code>last</code> not <code>99</code> in the last line?</p>
  
  <hr>
  
  <p>Given the <a href="http://en.cppreference.com/w/cpp/language/range-for">definition by the standard</a>, I would expect the behaviour I described in the first sentence.</p>
  
  <pre><code>{
    auto &amp;&amp; __range = range_expression ; 
    for (auto __begin = begin_expr, __end = end_expr; 
         __begin != __end; ++__begin) { 
      range_declaration = *__begin; 
      loop_statement 
    } 
  } 
  </code></pre>
  
  <p><code>range_declaration</code> being <code>last</code> and not <code>int last</code>, this should modify the existing variable.</p>