diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 173ada89de..c221115e8f 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1246,6 +1246,11 @@ #else # define QT_HAS_INCLUDE_NEXT(x) 0 #endif +#ifdef __has_feature +# define QT_HAS_FEATURE(x) __has_feature(x) +#else +# define QT_HAS_FEATURE(x) 0 +#endif /* * Warning/diagnostic handling diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 79053329a1..f2f28343c6 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -631,7 +631,12 @@ inline void qt_noop(void) {} */ #if !defined(QT_NO_EXCEPTIONS) -# if defined(QT_BOOTSTRAPPED) || (defined(Q_CC_GNU) && !defined (__EXCEPTIONS) && !defined(Q_MOC_RUN)) +# if !defined(Q_MOC_RUN) +# if (defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) && !QT_HAS_FEATURE(cxx_exceptions)) || \ + (defined(Q_CC_GNU) && !defined(__EXCEPTIONS)) +# define QT_NO_EXCEPTIONS +# endif +# elif defined(QT_BOOTSTRAPPED) # define QT_NO_EXCEPTIONS # endif #endif