https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49974
--- Comment #20 from Andrew Pinski ---
(In reply to Barry Revzin from comment #19)
> Another example of this:
>
> int get();
>
> int const& f() {
> int const r = get();
> return r;
> }
>
> int const& g() {
> int const& r = get();
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49974
Barry Revzin changed:
What|Removed |Added
CC||barry.revzin at gmail dot com
---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49974
--- Comment #18 from Martin Sebor ---
This detection is partially implemented in GCC 12 by the -Wdnagling-pointer:
$ cat pr49974.C && gcc -O -S -Wall pr49974.C
struct X { };
inline const X& f(const X& r) { return r; }
const X& g()
{
X x;
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49974
--- Comment #17 from Jonathan Wakely ---
95911 boils down to this:
#include
struct X { int i = 0; };
X&& f(X&& x) { return std::move(x); }
int main()
{
X&& x = f(X{});
return x.i;
}
With recent releases we get a -Wuninitialized
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49974
Jonathan Wakely changed:
What|Removed |Added
CC||570070308 at qq dot com
--- Comment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49974
Martin Sebor changed:
What|Removed |Added
CC||msebor at gcc dot gnu.org
See
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49974
Eric Gallager changed:
What|Removed |Added
Summary|missing warning for |missing -Wreturn-local-addr