Update aosp/master libcxx rebase to r263688

Change-Id: Ic3f4fb33a091ff4b7366ab9e6ca8ee99589c5c9f
diff --git a/include/regex b/include/regex
index c270cab..3724204 100644
--- a/include/regex
+++ b/include/regex
@@ -762,6 +762,7 @@
 #include <memory>
 #include <vector>
 #include <deque>
+#include <cassert>
 
 #include <__undef_min_max>
 
@@ -960,7 +961,9 @@
 void __throw_regex_error()
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS
-	throw regex_error(_Ev);
+    throw regex_error(_Ev);
+#else
+    assert(!"regex_error");
 #endif
 }
 
@@ -979,6 +982,8 @@
 
 #ifdef __ANDROID__
     static const char_class_type __regex_word = 0x8000;
+#elif defined(__mips__) && defined(__GLIBC__)
+    static const char_class_type __regex_word = static_cast<char_class_type>(_ISbit(15));
 #else
     static const char_class_type __regex_word = 0x80;
 #endif
@@ -1054,6 +1059,7 @@
     _LIBCPP_INLINE_VISIBILITY
     int __regex_traits_value(char __ch, int __radix) const
         {return __regex_traits_value(static_cast<unsigned char>(__ch), __radix);}
+    _LIBCPP_INLINE_VISIBILITY
     int __regex_traits_value(wchar_t __ch, int __radix) const;
 };
 
@@ -1276,7 +1282,7 @@
 }
 
 template <class _CharT>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
 int
 regex_traits<_CharT>::__regex_traits_value(wchar_t __ch, int __radix) const
 {
@@ -1739,6 +1745,8 @@
 void
 __back_ref<_CharT>::__exec(__state& __s) const
 {
+    if (__mexp_ > __s.__sub_matches_.size())
+        __throw_regex_error<regex_constants::error_backref>();
     sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_-1];
     if (__sm.matched)
     {
@@ -4268,6 +4276,9 @@
     if (__first != __last && *__first == '\\')
     {
         _ForwardIterator __t1 = _VSTD::next(__first);
+        if (__t1 == __last)
+            __throw_regex_error<regex_constants::error_escape>();
+
         _ForwardIterator __t2 = __parse_decimal_escape(__t1, __last);
         if (__t2 != __t1)
             __first = __t2;
@@ -5387,8 +5398,8 @@
                 if ('0' <= *__fmt_first && *__fmt_first <= '9')
                 {
                     size_t __i = *__fmt_first - '0';
-                    __out = _VSTD::copy(__matches_[__i].first,
-                                       __matches_[__i].second, __out);
+                    __out = _VSTD::copy((*this)[__i].first,
+                                        (*this)[__i].second, __out);
                 }
                 else
                 {
@@ -5439,8 +5450,8 @@
                             ++__fmt_first;
                             __i = 10 * __i + *__fmt_first - '0';
                         }
-                        __out = _VSTD::copy(__matches_[__i].first,
-                                           __matches_[__i].second, __out);
+                        __out = _VSTD::copy((*this)[__i].first,
+                                            (*this)[__i].second, __out);
                     }
                     else
                     {