aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2024-05-23 15:49:42 -0400
committerMarek Polacek <polacek@redhat.com>2024-05-28 15:03:44 -0400
commitefaaae49b307fcc7e771518da3edae49f92c19db (patch)
treeea97b2f94b7833ce721aae9ab08a18f018078fbb /libcpp
parent5ada486079d6aa20c64985a20681573f4ac1c86e (diff)
downloadgcc-efaaae49b307fcc7e771518da3edae49f92c19db.zip
gcc-efaaae49b307fcc7e771518da3edae49f92c19db.tar.gz
gcc-efaaae49b307fcc7e771518da3edae49f92c19db.tar.bz2
c++: extend -Wself-move for mem-init-list [PR109396]
We already warn for: x = std::move (x); which triggers: warning: moving 'x' of type 'int' to itself [-Wself-move] but bug 109396 reports that this doesn't work for a member-initializer-list: X() : x(std::move (x)) so this patch amends that. PR c++/109396 gcc/cp/ChangeLog: * cp-tree.h (maybe_warn_self_move): Declare. * init.cc (perform_member_init): Call maybe_warn_self_move. * typeck.cc (maybe_warn_self_move): No longer static. Change the return type to bool. Also warn when called from a member-initializer-list. Drop the inform call. gcc/testsuite/ChangeLog: * g++.dg/warn/Wself-move2.C: New test.
Diffstat (limited to 'libcpp')
0 files changed, 0 insertions, 0 deletions