[libcxx-commits] [PATCH] D61195: [libcxx] Portability fix: std::regex_constants::error_type values are not requied to be non-zero.

Andrey Maksimov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Apr 26 08:42:23 PDT 2019


amakc11 created this revision.
Herald added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, ldionne.

The standard requires the following <http://eel.is/c++draft/re.err#1> for the `std::regex_constants::error_type` values: "The type `error_­type` is an implementation-defined enumerated type". The values of this enumerated type are not required to be non-zero. This patch makes such checks in tests libc++-specific to let the tests pass for other conforming implementations.


Repository:
  rCXX libc++

https://reviews.llvm.org/D61195

Files:
  test/std/re/re.const/re.err/error_type.pass.cpp


Index: test/std/re/re.const/re.err/error_type.pass.cpp
===================================================================
--- test/std/re/re.const/re.err/error_type.pass.cpp
+++ test/std/re/re.const/re.err/error_type.pass.cpp
@@ -37,19 +37,19 @@
 
 int main(int, char**)
 {
-    assert(std::regex_constants::error_collate != 0);
-    assert(std::regex_constants::error_ctype != 0);
-    assert(std::regex_constants::error_escape != 0);
-    assert(std::regex_constants::error_backref != 0);
-    assert(std::regex_constants::error_brack != 0);
-    assert(std::regex_constants::error_paren != 0);
-    assert(std::regex_constants::error_brace != 0);
-    assert(std::regex_constants::error_badbrace != 0);
-    assert(std::regex_constants::error_range != 0);
-    assert(std::regex_constants::error_space != 0);
-    assert(std::regex_constants::error_badrepeat != 0);
-    assert(std::regex_constants::error_complexity != 0);
-    assert(std::regex_constants::error_stack != 0);
+    LIBCPP_ASSERT(std::regex_constants::error_collate != 0);
+    LIBCPP_ASSERT(std::regex_constants::error_ctype != 0);
+    LIBCPP_ASSERT(std::regex_constants::error_escape != 0);
+    LIBCPP_ASSERT(std::regex_constants::error_backref != 0);
+    LIBCPP_ASSERT(std::regex_constants::error_brack != 0);
+    LIBCPP_ASSERT(std::regex_constants::error_paren != 0);
+    LIBCPP_ASSERT(std::regex_constants::error_brace != 0);
+    LIBCPP_ASSERT(std::regex_constants::error_badbrace != 0);
+    LIBCPP_ASSERT(std::regex_constants::error_range != 0);
+    LIBCPP_ASSERT(std::regex_constants::error_space != 0);
+    LIBCPP_ASSERT(std::regex_constants::error_badrepeat != 0);
+    LIBCPP_ASSERT(std::regex_constants::error_complexity != 0);
+    LIBCPP_ASSERT(std::regex_constants::error_stack != 0);
 
     assert(std::regex_constants::error_collate != std::regex_constants::error_ctype);
     assert(std::regex_constants::error_collate != std::regex_constants::error_escape);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61195.196858.patch
Type: text/x-patch
Size: 1955 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190426/18a021ef/attachment.bin>


More information about the libcxx-commits mailing list