Strange warning in C++11 range based for loop
Pavel Dzhioev
dzhioev@gmail.com
Tue Aug 30 16:47:00 GMT 2011
I have changed my opinion, after reading standart draft. It says:
> The range-based for statement
> for ( for-range-declaration : expression ) statement
> is equivalent to
> {
> auto && __range = ( expression );
> for ( auto __begin = begin-expr, __end = end-expr; __begin != __end; ++__begin )
> {
> for-range-declaration = *__begin;
> statement
> }
>}
So formally `i' is unused variable in my case.
On 30 August 2011 20:34, Ian Lance Taylor <iant@google.com> 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.
>
> Ian
>
--
Павел Сергеев
More information about the Gcc-help
mailing list