public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106276] New: Missing -Wpessimizing-move warning
@ 2022-07-13  0:51 mpolacek at gcc dot gnu.org
  2022-07-13  7:21 ` [Bug c++/106276] " marxin at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-07-13  0:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106276

            Bug ID: 106276
           Summary: Missing -Wpessimizing-move warning
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

Looks like we're missing a warning on the std::move line here:

namespace std {
template <typename _Tp> _Tp &&move(_Tp &&);
}
char take_buffer;
struct label_text {
  label_text take() { return std::move(label_text(&take_buffer)); }
  label_text(char *);
};

$ xclang++ -c -Wall -W line-map.ii
line-map.ii:6:30: warning: moving a temporary object prevents copy elision
[-Wpessimizing-move]
  label_text take() { return std::move(label_text(&take_buffer)); }
                             ^
line-map.ii:6:30: note: remove std::move call here
  label_text take() { return std::move(label_text(&take_buffer)); }
                             ^~~~~~~~~~                        ~
$ xg++ -c -Wall -W line-map.ii
$

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-08-15 14:04 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-13  0:51 [Bug c++/106276] New: Missing -Wpessimizing-move warning mpolacek at gcc dot gnu.org
2022-07-13  7:21 ` [Bug c++/106276] " marxin at gcc dot gnu.org
2022-07-13 11:58 ` mpolacek at gcc dot gnu.org
2022-07-13 18:36 ` dcb314 at hotmail dot com
2022-07-13 19:09 ` mpolacek at gcc dot gnu.org
2022-07-13 20:16 ` redi at gcc dot gnu.org
2022-07-13 20:19 ` redi at gcc dot gnu.org
2022-07-16  0:43 ` mpolacek at gcc dot gnu.org
2022-08-15 14:00 ` cvs-commit at gcc dot gnu.org
2022-08-15 14:04 ` mpolacek at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).