Fix debug mode build w/o exceptions

llvm-svn: 290652
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: ab768a85f686d8334d9c96752e5da1ee14c119cb
diff --git a/include/__debug b/include/__debug
index e3a5ec9..e0cef09 100644
--- a/include/__debug
+++ b/include/__debug
@@ -82,6 +82,9 @@
 
 // Setup the throwing debug handler during dynamic initialization.
 #if _LIBCPP_DEBUG_LEVEL >= 1 && defined(_LIBCPP_DEBUG_USE_EXCEPTIONS)
+# if defined(_LIBCPP_NO_EXCEPTIONS)
+#   error _LIBCPP_DEBUG_USE_EXCEPTIONS cannot be used when exceptions are disabled.
+# endif
 static bool __init_dummy = __libcpp_set_debug_function(__libcpp_throw_debug_function);
 #endif