]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix test that fails with -ffreestanding
authorJonathan Wakely <jwakely@redhat.com>
Thu, 9 Nov 2023 21:50:34 +0000 (21:50 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Sat, 11 Nov 2023 00:41:09 +0000 (00:41 +0000)
The -ffreestanding option disables Debug Mode, forcibly #undef'ing
_GLIBCXX_DEBUG. This means that the dangling checks in std::pair are
disabled for -ffreestanding in C++17 and earlier, because they depend on
_GLIBCXX_DEBUG. Adjust the target specifiers for the errors currently
matching c++17_down so they also require the hosted effective target.

libstdc++-v3/ChangeLog:

* testsuite/20_util/pair/dangling_ref.cc: Add hosted effective
target for specifiers using c++17_down.

libstdc++-v3/testsuite/20_util/pair/dangling_ref.cc

index 8e0c34816ddc52f5e550da601510b4df9dbf82fb..ca238f9cbd1eec0736fed051d13eb0d50e838f68 100644 (file)
@@ -22,15 +22,15 @@ void
 test_binary_ctors()
 {
   std::pair<const int&, int> p1(1L, 2);
-  // { dg-error "here" "" { target c++17_down } 24 }
+  // { dg-error "here" "" { target { c++17_down && hosted } } 24 }
   // { dg-error "use of deleted function" "" { target c++20 } 24 }
 
   std::pair<int, const int&> p2(1, 2L);
-  // { dg-error "here" "" { target c++17_down } 28 }
+  // { dg-error "here" "" { target { c++17_down && hosted } } 28 }
   // { dg-error "use of deleted function" "" { target c++20 } 28 }
 
   std::pair<const int&, const int&> p3(1L, 2L);
-  // { dg-error "here" "" { target c++17_down } 32 }
+  // { dg-error "here" "" { target { c++17_down && hosted } } 32 }
   // { dg-error "use of deleted function" "" { target c++20 } 32 }
 }
 
@@ -40,28 +40,28 @@ test_converting_ctors()
   std::pair<long, long> p0;
 
   std::pair<const int&, int> p1(p0);
-  // { dg-error "here" "" { target c++17_down } 42 }
+  // { dg-error "here" "" { target { c++17_down && hosted } } 42 }
   // { dg-error "use of deleted function" "" { target c++20 } 42 }
 
   std::pair<int, const int&> p2(p0);
-  // { dg-error "here" "" { target c++17_down } 46 }
+  // { dg-error "here" "" { target { c++17_down && hosted } } 46 }
   // { dg-error "use of deleted function" "" { target c++20 } 46 }
 
   std::pair<const int&, const int&> p3(p0);
-  // { dg-error "here" "" { target c++17_down } 50 }
+  // { dg-error "here" "" { target { c++17_down && hosted } } 50 }
   // { dg-error "use of deleted function" "" { target c++20 } 50 }
 
   std::pair<const int&, int> p4(std::move(p0));
-  // { dg-error "here" "" { target c++17_down } 54 }
+  // { dg-error "here" "" { target { c++17_down && hosted } } 54 }
   // { dg-error "use of deleted function" "" { target c++20 } 54 }
 
   std::pair<int, const int&> p5(std::move(p0));
-  // { dg-error "here" "" { target c++17_down } 58 }
+  // { dg-error "here" "" { target { c++17_down && hosted } } 58 }
   // { dg-error "use of deleted function" "" { target c++20 } 58 }
 
   std::pair<const int&, const int&> p6(std::move(p0));
-  // { dg-error "here" "" { target c++17_down } 62 }
+  // { dg-error "here" "" { target { c++17_down && hosted } } 62 }
   // { dg-error "use of deleted function" "" { target c++20 } 62 }
 }
 
-// { dg-error "static assert.* dangling reference" "" { target { c++17_down } } 0 }
+// { dg-error "static assert.* dangling reference" "" { target { c++17_down && hosted } } 0 }