[Bug c++/49974] missing warning for indirectly returning reference to local/temporary
egallager at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Nov 20 13:37:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49974
--- Comment #12 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #11)
> (In reply to Jonathan Wakely from comment #4)
> > As pointed out in PR 52901 comment 3, this missing warning is likely to bite
> > people misusing std::move like so:
> >
> > X&& f()
> > {
> > X x;
> > return std::move(x);
> > }
>
> I created PR 86982 for the special cases of std::move and std::forward, as I
> think they're important.
>
> This bug is for the more general case.
86982 requested the warning go under -Wreturn-local-addr; is that what this one
would go under, too?
More information about the Gcc-bugs
mailing list