https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83860
--- Comment #6 from Marc Glisse <glisse at gcc dot gnu.org> --- GMP's expression templates, which are based on libstdc++ valarray, have the same issue. I tried using values in GMP ( https://gmplib.org/list-archives/gmp-bugs/2014-January/003319.html ). I never committed it for lack of time, but it seemed to improve performance as well, not just safety. Somehow gcc/llvm had an easier time seeing through the expressions with (copied) values. Not sure this applies to valarray though, since the expressions have bounded depth there. The real solution is still to avoid mixing auto with expression templates, at least until we get some version of what was once proposed as "operator auto". Maybe invent some [[warn_auto]] attribute?