From: Paolo Carlini Date: Tue, 11 Jul 2017 21:24:11 +0000 (+0000) Subject: re PR c++/51270 (missed warning about returning reference to temporary) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9e028cef373b899c4e64f34c077ec5913b48c81b;p=gcc.git re PR c++/51270 (missed warning about returning reference to temporary) 2017-07-11 Paolo Carlini PR c++/51270 * g++.dg/warn/Wreturn-local-addr-3.C: New. From-SVN: r250140 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bf7c03e4695..a5721e9fa64 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-07-11 Paolo Carlini + + PR c++/51270 + * g++.dg/warn/Wreturn-local-addr-3.C: New. + 2017-07-11 Carl Love * gcc.target/powerpc/builtins-2-p9-runnable.c: Add new file with diff --git a/gcc/testsuite/g++.dg/warn/Wreturn-local-addr-3.C b/gcc/testsuite/g++.dg/warn/Wreturn-local-addr-3.C new file mode 100644 index 00000000000..52607b62284 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wreturn-local-addr-3.C @@ -0,0 +1,8 @@ +// PR c++/51270 +// { dg-options "-O2" } + +const int& f(long l) +{ + const int& i = l; + return i; // { dg-warning "address of local variable" } +}