summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qglobal.cpp4
-rw-r--r--src/corelib/global/qglobal.h2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 65c72d9abe..139c8f3a30 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -3098,7 +3098,11 @@ void qt_check_pointer(const char *n, int l) noexcept
*/
void qBadAlloc()
{
+#ifndef QT_NO_EXCEPTIONS
QT_THROW(std::bad_alloc());
+#else
+ std::terminate();
+#endif
}
#ifndef QT_NO_EXCEPTIONS
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index fbadab4f3b..47ffe17034 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -921,7 +921,7 @@ Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *
#endif
Q_NORETURN Q_CORE_EXPORT void qt_check_pointer(const char *, int) noexcept;
-Q_DECL_COLD_FUNCTION
+Q_NORETURN Q_DECL_COLD_FUNCTION
Q_CORE_EXPORT void qBadAlloc();
#ifdef QT_NO_EXCEPTIONS