fix bug incrementing past end in search

llvm-svn: 109716
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 7949ab0743d9555cb2c2885d9c8e8fc1e0b64265
diff --git a/include/regex b/include/regex
index 519c723..efcc7df 100644
--- a/include/regex
+++ b/include/regex
@@ -1883,7 +1883,7 @@
     virtual string speak() const
     {
         ostringstream os;
-        if (__invert_)
+        if (!__invert_)
             os << "__word_boundary";
         else
             os << "not __word_boundary";
@@ -5404,7 +5404,7 @@
         __m.__suffix_.matched = __m.__suffix_.first != __m.__suffix_.second;
         return true;
     }
-    if (!(__flags & regex_constants::match_continuous))
+    if (__first != __last && !(__flags & regex_constants::match_continuous))
     {
         __m.__matches_.assign(__m.size(), __m.__unmatched_);
         for (++__first; __first != __last; ++__first)