Boost logo

Boost Users :

Subject: Re: [Boost-users] [foreach] gcc 4.5 & 4.6 compiler error with BOOST_FOREACH(auto&& ...) loop
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2011-03-05 08:38:17


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



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net