std::move() does not move a constant of a class type

Roman Kononov roman@binarylife.net
Sun Nov 28 19:12:00 GMT 2010


On 2010-11-27, 16:37:07 -0800, James Dennett <james.dennett@gmail.com>
wrote:
> 4.6 appears to be right -- you cannot bind an X&& to a const X (which
> is good, as otherwise you could change the const X).

Should this one emit the same error then? 4.6 compiles it.

typedef int X;
X test() {
   X const& a={};
   return std::move(a);
}

Thanks



More information about the Gcc mailing list