https://gcc.gnu.org/g:4bdae1b5f350960f6272a87eca82a821a34aa944
commit r14-12157-g4bdae1b5f350960f6272a87eca82a821a34aa944 Author: Jonathan Wakely <[email protected]> Date: Thu Sep 26 23:43:20 2024 +0100 libstdc++: Fix test FAILs due to -Wreturn-local-addr This fixes two FAILs due to -Wreturn-local-addr 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. (cherry picked from commit c580b8a2b59208efc687e2b706e3a40225167854) Diff: --- libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc | 1 + libstdc++-v3/testsuite/30_threads/packaged_task/cons/dangling_ref.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc b/libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc index eefaccd4badb..32af0a27b8fe 100644 --- a/libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc +++ b/libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc @@ -6,5 +6,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 } 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 efe72eb99f52..83411c7024e9 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 @@ -8,6 +8,7 @@ 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 } // { dg-error "static assertion failed" "" { target c++17 } 0 }
