https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67906
--- Comment #4 from Nikolay Orliuk <virkony at gmail dot com> ---
Hello
Sure,
struct Value {
Value();
Value(const Value&);
Value(Value&&);
};
struct Frame {
Value value; // previously mutable
};
Frame top;
const Frame& x = top;
Value y = std::move(x.value);
https://godbolt.org/g/v24FfQ
Thank you for looking into it. Yes, there should be better names than
-Wno-effect. Maybe -Wignored-move and -Wmove-const are slightly better.
Such warning will help to identify places which become ineffecient after
changing constness of something.
P.S. By some reason I were not able to leave comment in Bugzilla and got
message "User account creation filtered due to spam." though I were logged
in.
Thank you,
Mykola
On Thu, Aug 24, 2017 at 7:40 AM egallager at gcc dot gnu.org <
[email protected]> wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67906
>
> Eric Gallager <egallager at gcc dot gnu.org> changed:
>
> What |Removed |Added
>
> ----------------------------------------------------------------------------
> Keywords| |diagnostic
> Status|UNCONFIRMED |WAITING
> Last reconfirmed| |2017-08-24
> CC| |egallager at gcc dot
> gnu.org
> Ever confirmed|0 |1
>
> --- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
> Could you please provide a complete self-contained example? The snippet you
> posted looks like it's missing some declarations:
>
> $ /usr/local/bin/g++ -c 67906.cc
> 67906.cc:1:7: error: ‘Frame’ does not name a type
> const Frame& x = stack.top();
> ^~~~~
> 67906.cc:2:1: error: ‘Value’ does not name a type
> Value y = std::move(x.value); // x.value - non-mutable
> ^~~~~
> $
>
> Anyways, bug 81159 is related, but that's about a different misuse of
> std::move, so I'll keep the 2 separate.
>
> Oh, and also "-Wno-effect" would probably be a bad name for the option,
> since
> "-Wno-" is reserved for negative versions of warnings. i.e., is
> "-Wno-effect"
> the negative of "-Weffect"? That seems wrong. Or is it already in the
> positive,
> in which case the negative is "-Wno-no-effect"? That would seem redundant.
>
> --
> You are receiving this mail because:
> You reported the bug.