Strange warning in C++11 range based for loop

Marc Glisse marc.glisse@inria.fr
Tue Aug 30 17:00:00 GMT 2011


On Tue, 30 Aug 2011, Ian Lance Taylor wrote:

> Jonathan Wakely <jwakely.gcc@gmail.com> writes:
>
>> You could file an enhancement request in Bugzilla requesting that the
>> warning is disabled for the variable in the for-range-declaration.
>
> Personally I think this is the way to go.  The variable is implicitly
> used, and the warning should reflect that.

If C++ had allowed for(int:range) in addition to for(int i:range), like 
you can abstain from naming function arguments, the warning would have 
made more sense. As it is, I agree the warning should go, although I don't 
know why you say the variable is implicitly used.

-- 
Marc Glisse



More information about the Gcc-help mailing list