https://gcc.gnu.org/g:3418d740b344e0ba38022f3bed90540ec3de35dd

commit r14-11702-g3418d740b344e0ba38022f3bed90540ec3de35dd
Author: François Dumont <frs.dum...@gmail.com>
Date:   Mon Apr 28 18:53:36 2025 +0200

    libstdc++: [_GLIBCXX_INLINE_VERSION] Fix tests failures
    
    Adapt testsuite v3_target_compile to strip version namespace from compiler
    output so that dg-error and dg-warning directives do not need to consider 
it.
    
    libstdc++-v3/ChangeLog:
    
            * testsuite/lib/libstdc++.exp (v3_target_compile): Strip version 
namespace
            from compiler output.
            * testsuite/20_util/function/cons/70692.cc: Remove now useless __8 
namespace
            pattern.
            * testsuite/23_containers/map/48101_neg.cc: Likewise.
            * testsuite/23_containers/multimap/48101_neg.cc: Likewise.
    
    Co-authored-by: Jonathan Wakely <jwak...@redhat.com>
    
    (cherry picked from commit 8709d6a17830c8a9f48cb3ac6dfc6af76f2e1e81)

Diff:
---
 libstdc++-v3/testsuite/20_util/function/cons/70692.cc      | 2 +-
 libstdc++-v3/testsuite/23_containers/map/48101_neg.cc      | 4 ++--
 libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc | 4 ++--
 libstdc++-v3/testsuite/lib/libstdc++.exp                   | 5 +++++
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/libstdc++-v3/testsuite/20_util/function/cons/70692.cc 
b/libstdc++-v3/testsuite/20_util/function/cons/70692.cc
index b15208a25317..f9e8fe31570c 100644
--- a/libstdc++-v3/testsuite/20_util/function/cons/70692.cc
+++ b/libstdc++-v3/testsuite/20_util/function/cons/70692.cc
@@ -11,4 +11,4 @@ int main()
   std::function<const int&()> ff(f);  // { dg-error "no matching function" }
   std::function<long&&()> f2(f);      // { dg-error "no matching function" }
 }
-// { dg-error "std::(__8::)?enable_if" "" { target *-*-* } 0 }
+// { dg-error "std::enable_if" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc 
b/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc
index 71deaef28810..264034d2d50d 100644
--- a/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc
@@ -28,8 +28,8 @@ test01()
   c2.find(2); // { dg-error "here" }
 }
 
-// { dg-error "_Compare = std::(__8::)?less<int.>" "" { target *-*-* } 0 }
-// { dg-error "_Compare = std::(__8::)?allocator<int>" "" { target *-*-* } 0 }
+// { dg-error "_Compare = std::less<int.>" "" { target *-*-* } 0 }
+// { dg-error "_Compare = std::allocator<int>" "" { target *-*-* } 0 }
 // { dg-error "comparison object must be invocable" "" { target *-*-* } 0 }
 // { dg-prune-output "no match for call" }
 // { dg-prune-output "invalid conversion" }
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc 
b/libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc
index 5b40fe3e0213..038b9f12141b 100644
--- a/libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc
@@ -28,8 +28,8 @@ test01()
   c2.find(2); // { dg-error "here" }
 }
 
-// { dg-error "_Compare = std::(__8::)?less<int.>" "" { target *-*-* } 0 }
-// { dg-error "_Compare = std::(__8::)?allocator<int>" "" { target *-*-* } 0 }
+// { dg-error "_Compare = std::less<int.>" "" { target *-*-* } 0 }
+// { dg-error "_Compare = std::allocator<int>" "" { target *-*-* } 0 }
 // { dg-error "comparison object must be invocable" "" { target *-*-* } 0 }
 // { dg-prune-output "no match for call" }
 // { dg-prune-output "invalid conversion" }
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp 
b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 67a63f5b5f39..927f7739d08c 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -650,6 +650,11 @@ proc v3_target_compile { source dest type options } {
     }
 
     set comp_output [target_compile $source $dest $type $options]
+
+    # Strip versioned namespace from the compiler output,
+    # so that dg-error and dg-warning patterns can ignore it:
+    regsub -all "std::__8::" $comp_output "std::" comp_output
+
     if { $type == "executable" && $file_to_delete != "" } {
        file delete $file_to_delete
        if { [istarget *-*-darwin*] && [file exists $file_to_delete.dSYM] } {

Reply via email to