[libcxx] r245239 - Make regex and any assert when they should throw an exception _but_ the user has decreed 'no exceptions'. This matches the behavior of string and vector

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 17 14:14:16 PDT 2015


Author: marshall
Date: Mon Aug 17 16:14:16 2015
New Revision: 245239

URL: http://llvm.org/viewvc/llvm-project?rev=245239&view=rev
Log:
Make regex and any assert when they should throw an exception _but_ the user has decreed 'no exceptions'. This matches the behavior of string and vector

Modified:
    libcxx/trunk/include/experimental/any
    libcxx/trunk/include/regex

Modified: libcxx/trunk/include/experimental/any
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/any?rev=245239&r1=245238&r2=245239&view=diff
==============================================================================
--- libcxx/trunk/include/experimental/any (original)
+++ libcxx/trunk/include/experimental/any Mon Aug 17 16:14:16 2015
@@ -82,6 +82,7 @@ inline namespace fundamentals_v1 {
 #include <typeinfo>
 #include <type_traits>
 #include <cstdlib>
+#include <cassert>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
@@ -106,7 +107,7 @@ inline void __throw_bad_any_cast()
 #ifndef _LIBCPP_NO_EXCEPTIONS
     throw bad_any_cast();
 #else
-    _VSTD::abort();
+    assert(!"bad_any_cast");
 #endif
 }
 

Modified: libcxx/trunk/include/regex
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=245239&r1=245238&r2=245239&view=diff
==============================================================================
--- libcxx/trunk/include/regex (original)
+++ libcxx/trunk/include/regex Mon Aug 17 16:14:16 2015
@@ -762,6 +762,7 @@ typedef regex_token_iterator<wstring::co
 #include <memory>
 #include <vector>
 #include <deque>
+#include <cassert>
 
 #include <__undef_min_max>
 
@@ -960,7 +961,9 @@ _LIBCPP_ALWAYS_INLINE
 void __throw_regex_error()
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS
-	throw regex_error(_Ev);
+    throw regex_error(_Ev);
+#else
+    assert(!"regex_error");
 #endif
 }
 




More information about the cfe-commits mailing list