]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix test FAILs due to -Wreturn-local-addr
authorJonathan Wakely <jwakely@redhat.com>
Thu, 26 Sep 2024 22:43:20 +0000 (23:43 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 27 Sep 2024 15:28:12 +0000 (16:28 +0100)
This fixes two FAILs due to -Wpointer-arith warnings when testing with
c++11 or c++14 dialects.

libstdc++-v3/ChangeLog:

* testsuite/20_util/bind/dangling_ref.cc: Add an additional
dg-warning for -Wreturn-local-addr warning.
* testsuite/30_threads/packaged_task/cons/dangling_ref.cc:
Likewise.

libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc
libstdc++-v3/testsuite/30_threads/packaged_task/cons/dangling_ref.cc

index 70393e4392f8b5bd9c6b413defa347dfcfb41c26..17e7b21c45cbef0551552213025c25afed41912f 100644 (file)
@@ -5,5 +5,6 @@ int f();
 auto b = std::bind<const int&>(f);
 int i = b(); // { dg-error "here" "" { target { c++14_down } } }
 // { dg-error "dangling reference" "" { target { c++14_down } } 0 }
+// { dg-error "reference to temporary" "" { target { c++14_down } } 0 }
 // { dg-error "no matching function" "" { target c++17 } 0 }
 // { dg-error "enable_if" "" { target c++17 } 0 }
index e9edb5edc8bed4234b69ea8a2609ec916ac69d95..225b65fe6a7d499498814a192d1613b699aff057 100644 (file)
@@ -7,5 +7,6 @@
 int f();
 std::packaged_task<const int&()> task(f);
 // { dg-error "dangling reference" "" { target { c++14_down } } 0 }
+// { dg-error "reference to temporary" "" { target { c++14_down } } 0 }
 // { dg-error "no matching function" "" { target c++17 } 0 }
 // { dg-error "enable_if" "" { target c++17 } 0 }