From 9e028cef373b899c4e64f34c077ec5913b48c81b Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 11 Jul 2017 21:24:11 +0000 Subject: [PATCH] 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 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/warn/Wreturn-local-addr-3.C | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/Wreturn-local-addr-3.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bf7c03e..a5721e9 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 0000000..52607b6 --- /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" } +} -- 2.7.4