It would not break, but it’s still a logical fallacy to std::move something returned by value, no? Or is there a valid use case here?
I strictly use std::move in case of explicit transfer of ownership, and not to try to outsmart the compiler to ‘optimize’ something. As the article shows the compiler is smart enough to do all this by itself, it doesn’t need to be told to try to elide copies. But maybe I’m missing some valid use case where it would make sense to add the std::move in these kinds of situations?
You're right, there's not really a point in std::move-ing something returned by value because the something is already a rvalue.
No, because get_display_pixels returns by value and not by reference. So the move constructor will move from a newly constructed value, not the instance gfx variable.
If get_display_pixels returned by mutable reference and the author used std::vector, yes, the code might break.
Nit: array is not statically allocated; it's stack/automatically allocated.