If the range-based for loop function body is not a compound statement, we would fail to diagnose discarded results from the statement. This only impacted range-based for loops because other kinds of for loops already manually check the body for unused expression results.
This addresses PR39837.
Why "WarnOn"? Shouldn't this flag simply indicate whether the expression is a discarded-value expression?