[libcxx-commits] [PATCH] D66610: [libc++] Fix std::abs tests

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 22 11:30:05 PDT 2019


zoecarver created this revision.
Herald added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, christof.
Herald added a project: libc++.

On systems where sizeof(long) == sizeof(int)
the current tests failed. This commit updates
those tests to work on all systems.
std::abs has specific long specializations
which can be used instead.

Merge branch 'master' of github.com:llvm/llvm-project

fix: lwg 2584


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66610

Files:
  libcxx/include/regex
  libcxx/test/std/re/re.alg/re.alg.match/ecma.pass.cpp
  libcxx/www/cxx1z_status.html


Index: libcxx/www/cxx1z_status.html
===================================================================
--- libcxx/www/cxx1z_status.html
+++ libcxx/www/cxx1z_status.html
@@ -392,7 +392,7 @@
 	<tr><td><a href="https://wg21.link/LWG2569">2569</a></td><td>conjunction and disjunction requirements are too strict</td><td>Issaquah</td><td>Complete</td></tr>
 	<tr><td><a href="https://wg21.link/LWG2570">2570</a></td><td>[fund.ts.v2] conjunction and disjunction requirements are too strict</td><td>Issaquah</td><td></td></tr>
 	<tr><td><a href="https://wg21.link/LWG2578">2578</a></td><td>Iterator requirements should reference iterator traits</td><td>Issaquah</td><td>Complete</td></tr>
-	<tr><td><a href="https://wg21.link/LWG2584">2584</a></td><td><regex> ECMAScript IdentityEscape is ambiguous</td><td>Issaquah</td><td></td></tr>
+	<tr><td><a href="https://wg21.link/LWG2584">2584</a></td><td><regex> ECMAScript IdentityEscape is ambiguous</td><td>Issaquah</td><td>Complete</td></tr>
 	<tr><td><a href="https://wg21.link/LWG2587">2587</a></td><td>"Convertible to bool" requirement in conjunction and disjunction</td><td>Issaquah</td><td></td></tr>
 	<tr><td><a href="https://wg21.link/LWG2588">2588</a></td><td>[fund.ts.v2] "Convertible to bool" requirement in conjunction and disjunction</td><td>Issaquah</td><td></td></tr>
 	<tr><td><a href="https://wg21.link/LWG2589">2589</a></td><td>match_results can't satisfy the requirements of a container</td><td>Issaquah</td><td>Complete</td></tr>
Index: libcxx/test/std/re/re.alg/re.alg.match/ecma.pass.cpp
===================================================================
--- libcxx/test/std/re/re.alg/re.alg.match/ecma.pass.cpp
+++ libcxx/test/std/re/re.alg/re.alg.match/ecma.pass.cpp
@@ -1391,6 +1391,25 @@
         assert(m.position(0) == 0);
         assert(m.str(0) == s);
     }
+    {   // Issue2584: identify escape. Match exact chars/strings.
+        const std::regex r1("\\z");
+        assert(std::regex_match("z", r1));
+
+        const std::regex r2("\\zz");
+        assert(std::regex_match("zz", r2));
+
+        // const std::regex r3("\\zz");
+        // assert(std::regex_match("zzz", r3));
+
+        const std::regex r4("\\zx");
+        assert(std::regex_match("zx", r4));
+
+        // const std::regex r5("\\zx");
+        // assert(std::regex_match("zxx", r5));
+
+        // const std::regex r6("\\zx");
+        // assert(std::regex_match("zxz", r6));
+    }
 
   return 0;
 }
Index: libcxx/include/regex
===================================================================
--- libcxx/include/regex
+++ libcxx/include/regex
@@ -4421,6 +4421,9 @@
             __ml->__add_char('_');
             ++__first;
             break;
+        default:
+            __ml = __start_matching_list(true);
+            ++__first;
         }
     }
     return __first;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66610.216678.patch
Type: text/x-patch
Size: 2829 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190822/096f4519/attachment.bin>


More information about the libcxx-commits mailing list