]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix '23_containers/span/at.cc' for '-fno-exceptions' configurations
authorThomas Schwinge <thomas@codesourcery.com>
Tue, 28 Nov 2023 16:30:13 +0000 (17:30 +0100)
committerThomas Schwinge <thomas@codesourcery.com>
Wed, 29 Nov 2023 13:12:56 +0000 (14:12 +0100)
Added in recent commit 1fa85dcf656e2f2c7e483c9ed3c2680bf7db6858
"libstdc++: Add std::span::at for C++26 (P2821R5)", the test case already
does use '#if __cpp_exceptions', but failed to correspondingly guard the
'dg-warning' directives, resulting in:

    FAIL: 23_containers/span/at.cc  -std=gnu++26  (test for warnings, line 15)
    FAIL: 23_containers/span/at.cc  -std=gnu++26  (test for warnings, line 26)
    PASS: 23_containers/span/at.cc  -std=gnu++26 (test for excess errors)
    PASS: 23_containers/span/at.cc  -std=gnu++26 execution test

libstdc++-v3/
* testsuite/23_containers/span/at.cc: Fix for '-fno-exceptions'
configurations.

libstdc++-v3/testsuite/23_containers/span/at.cc

index dc4d8e3e8eb748586d360e3fa68570019e9605b6..6f6fc396bc7837b498d21959b54e74b868b75ee7 100644 (file)
@@ -12,7 +12,7 @@ test_at()
   VERIFY(s.at(2) == 2);
 #if __cpp_exceptions
   try {
-    s.at(4); // { dg-warning "ignoring return value" }
+    s.at(4); // { dg-warning "ignoring return value" "" { target exceptions_enabled } }
     VERIFY(false);
   } catch (const std::out_of_range&) {
   }
@@ -23,7 +23,7 @@ test_at()
   VERIFY(s2.at(1) == 2);
 #if __cpp_exceptions
   try {
-    s2.at(2); // { dg-warning "ignoring return value" }
+    s2.at(2); // { dg-warning "ignoring return value" "" { target exceptions_enabled } }
     VERIFY(false);
   } catch (const std::out_of_range&) {
   }