On 30 August 2011 17:46, Pavel Dzhioev wrote: > 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. Formally, yes, but the grammar does not allow you to omit the name, as in: for (auto : range(N)) or even for (: range(N)) and your example is reasonable, so I can see an argument for disabling the warning. On the other hand, it could be useful sometimes: for (auto i : get_range()) { for (auto j : get_range2(i)) { frobnicate(i); // OOPS should be frobnicate(j) } } Here it might be useful to be warned that 'j' is unused