From: Jonathan Wakely Date: Thu, 26 Sep 2024 22:43:20 +0000 (+0100) Subject: libstdc++: Fix test FAILs due to -Wreturn-local-addr X-Git-Tag: basepoints/gcc-16~5621 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=c580b8a2b59208efc687e2b706e3a40225167854;p=thirdparty%2Fgcc.git libstdc++: Fix test FAILs due to -Wreturn-local-addr 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. --- diff --git a/libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc b/libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc index 70393e4392f8..17e7b21c45cb 100644 --- a/libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc +++ b/libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc @@ -5,5 +5,6 @@ int f(); auto b = std::bind(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 } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/dangling_ref.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/dangling_ref.cc index e9edb5edc8be..225b65fe6a7d 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/dangling_ref.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/dangling_ref.cc @@ -7,5 +7,6 @@ int f(); std::packaged_task 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 }