https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51270
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu.org
Depends on| |60517
--- Comment #9 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #7)
> Here's a simpler testcase for the missed warning:
>
> const int& f(long l)
> {
> const int& i = l;
> return i;
> }
>
We now warn for this testcase because of the fixes in R60517.
test.cc:5:10: warning: function returns address of local variable
[-Wreturn-local-addr]
return i;
^
test.cc:4:18: note: declared here
const int& i = l;
^
I haven't tested the other testcases here, but it seems a duplicate.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60517
[Bug 60517] warning/error for taking address of member of a temporary object