diff options
author | Marek Polacek <polacek@redhat.com> | 2022-08-22 19:13:16 -0400 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2022-08-23 18:40:14 -0400 |
commit | 8567d9491d06832ea34b564c6bace9f7d43099ae (patch) | |
tree | bb93432514f378c36483105f0dbf0284a62bf2f1 /gcc/po | |
parent | 4ade41de1a6c80db6bb61399da6bff2126813d75 (diff) | |
download | gcc-8567d9491d06832ea34b564c6bace9f7d43099ae.zip gcc-8567d9491d06832ea34b564c6bace9f7d43099ae.tar.gz gcc-8567d9491d06832ea34b564c6bace9f7d43099ae.tar.bz2 |
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.
Diffstat (limited to 'gcc/po')
0 files changed, 0 insertions, 0 deletions