On 05.03.2011, at 14:11, Mathias Gaunard wrote:

On 05/03/2011 03:13, Nathan Ridge wrote:


The native range-based for version, however, compiles fine with gcc 4.6 (which is the only version to support it):

#include<boost/foreach.hpp>

template<typename>
void f()
{
    int A[6];
    for(auto&&  x : A)
        ;
}

Why does this compile? I don't see how any rvalue can be available in that context.

Wouldn't auto deduction make x an lvalue reference here?

Sebastian