The lifetime of objects in valarray's expressions is not properly extended (GCC/clang, the expression template mechanism keeps expressions as const&).
A potential solution is to detect deferred expressions that fail std::is_move_assignable and std::is_copy_assignable and store them in deferred::expression_