public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67906] New: Missing warning about std::move without effect
@ 2015-10-09 7:56 virkony at gmail dot com
2022-08-04 14:59 ` [Bug c++/67906] " mpolacek at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: virkony at gmail dot com @ 2015-10-09 7:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67906
Bug ID: 67906
Summary: Missing warning about std::move without effect
Product: gcc
Version: 5.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: virkony at gmail dot com
Target Milestone: ---
It would be nice to have something like -Wno-effect which will issue warnings
on usage of std::move for objects that cannot be moved.
See also http://stackoverflow.com/q/28595117/230744
I assume that it may require introducing differentiation between
explicit-rvalue (through std::move()/cast) and implicit-rvalue.
This may save from errors like:
```
const Frame& x = stack.top();
Value y = std::move(x.value); // x.value - non-mutable
```
Though there might be a false-positives in template functions or when developer
expects that in future function will have move overload for that argument.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/67906] Missing warning about std::move without effect
2015-10-09 7:56 [Bug c++/67906] New: Missing warning about std::move without effect virkony at gmail dot com
@ 2022-08-04 14:59 ` mpolacek at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-08-04 14:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67906
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #11 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I'm going to add a testcase that ensures that we don't warn for
struct X {
X() { }
X(const X&) { }
X(const X&&) { }
};
const X x;
const X y = std::move(x);
but otherwise I don't see any useful extension to our std::move warnings.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-04 14:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-09 7:56 [Bug c++/67906] New: Missing warning about std::move without effect virkony at gmail dot com
2022-08-04 14:59 ` [Bug c++/67906] " 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).