re PR c++/51270 (missed warning about returning reference to temporary)
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 11 Jul 2017 21:24:11 +0000 (21:24 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 11 Jul 2017 21:24:11 +0000 (21:24 +0000)
2017-07-11  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/51270
* g++.dg/warn/Wreturn-local-addr-3.C: New.

From-SVN: r250140

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/Wreturn-local-addr-3.C [new file with mode: 0644]

index bf7c03e4695548a05cf19293160b620b0a03eb4b..a5721e9fa64f91af20aabe79ca4e0765bcd4a6ed 100644 (file)
@@ -1,3 +1,8 @@
+2017-07-11  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/51270
+       * g++.dg/warn/Wreturn-local-addr-3.C: New.
+
 2017-07-11  Carl Love  <cel@us.ibm.com>
 
        * 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 (file)
index 0000000..52607b6
--- /dev/null
@@ -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" }
+}