http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49022
--- Comment #24 from Gabriel Dos Reis <gdr at gcc dot gnu.org> 2011-06-14 13:54:13 UTC --- (In reply to comment #18) > It should be identical to > > auto&& range = v1 + v2; > for (auto b = std::begin(range), e = std::end(range); b != e; ++b) > { ... } > (see 6.5.4 [stmt.ranged]) This will not work with expression template-based implementation of valarray. The reason is that `range' may be a surrogate, and you are likely to get rubbish addresses. I urge people to drop range-based iteration on valarrays. It wasn't something we were dieing for. It grew out of someone's idea of "uniformity" that failed to appreciate that a valarray is not your usual container. - Gaby