From fc93ce7349733e4ddbe72f5a5e46442ee2b82e15 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 17 Aug 2015 21:14:16 +0000 Subject: [PATCH] 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 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245239 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/any | 3 ++- include/regex | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/experimental/any b/include/experimental/any index a38397a99..336d6ceeb 100644 --- a/include/experimental/any +++ b/include/experimental/any @@ -82,6 +82,7 @@ inline namespace fundamentals_v1 { #include #include #include +#include #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 } diff --git a/include/regex b/include/regex index 6aecd916e..b355bbb3a 100644 --- a/include/regex +++ b/include/regex @@ -762,6 +762,7 @@ typedef regex_token_iterator wsregex_token_iterator; #include #include #include +#include #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 }