[PATCH] D27095: Protect std::array tests under noexceptions

Roger Ferrer Ibanez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 29 09:13:55 PST 2016


rogfer01 updated this revision to Diff 79589.
rogfer01 added a comment.

Add missing assertions in the original test.


https://reviews.llvm.org/D27095

Files:
  test/std/containers/sequences/array/at.pass.cpp


Index: test/std/containers/sequences/array/at.pass.cpp
===================================================================
--- test/std/containers/sequences/array/at.pass.cpp
+++ test/std/containers/sequences/array/at.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// XFAIL: libcpp-no-exceptions
 // <array>
 
 // reference operator[] (size_type)
@@ -40,8 +39,14 @@
         r2 = 7.5;
         assert(c.back() == 7.5);
 
-        try { (void) c.at(3); }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+        try
+        {
+            (void) c.at(3);
+            assert(false);
+        }
         catch (const std::out_of_range &) {}
+#endif
     }
     {
         typedef double T;
@@ -53,8 +58,14 @@
         C::const_reference r2 = c.at(2);
         assert(r2 == 3.5);
 
-        try { (void) c.at(3); }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+        try
+        {
+            (void) c.at(3);
+            assert(false);
+        }
         catch (const std::out_of_range &) {}
+#endif
     }
 
 #if TEST_STD_VER > 11


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27095.79589.patch
Type: text/x-patch
Size: 1074 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161129/c4bcde23/attachment.bin>


More information about the cfe-commits mailing list