c++: Quash bogus -Wredundant-move warning
This patch fixes a pretty stoopid thinko. When I added code to warn
about pessimizing std::move in initializations like
T t{std::move(T())};
I also added code to unwrap the expression from { }. But when we have
return {std::move(t)};
we cannot warn about a redundant std::move because the implicit move
wouldn't happen for "return {t};" because the expression isn't just
a name. However, we still want to warn about
return {std::move(T())};
so let's not disable the -Wpessimizing-move warning. Tests added for
both cases.
gcc/cp/ChangeLog:
* typeck.cc (maybe_warn_pessimizing_move): Don't warn about
redundant std::move when the expression was wrapped in { }.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/Wpessimizing-move10.C: New test.
* g++.dg/cpp0x/Wredundant-move12.C: New test.