On 08/30/2011 06:14 PM, Ian Lance Taylor wrote: > Marc Glisse <marc.glisse@xxxxxxxx> writes: > >> On Tue, 30 Aug 2011, Ian Lance Taylor wrote: >> >>> Jonathan Wakely <jwakely.gcc@xxxxxxxxx> 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. > > The variable is implicitly used in the generated code: each element of > the iterable is assigned to it in turn. Those assignments are likely > later discarded as dead, but there is still an implicit use. But an assignment is considered a def (rather than a use) by that warning. Isn't it? Andrew.