summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qglobal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global/qglobal.cpp')
-rw-r--r--src/corelib/global/qglobal.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 2ec14a6a46..0addd47729 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -59,8 +59,10 @@
#include <stdarg.h>
#include <string.h>
-#include <string>
-#include <exception>
+#include <exception> // For std::terminate
+#ifndef QT_NO_EXCEPTIONS
+#include <new> // For std::bad_alloc
+#endif
#include <errno.h>
#if defined(Q_CC_MSVC)
@@ -3096,7 +3098,11 @@ void qt_check_pointer(const char *n, int l) noexcept
*/
void qBadAlloc()
{
- QT_THROW(std::bad_alloc());
+#ifndef QT_NO_EXCEPTIONS
+ throw std::bad_alloc();
+#else
+ std::terminate();
+#endif
}
/*