summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qcompilerdetection.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global/qcompilerdetection.h')
-rw-r--r--src/corelib/global/qcompilerdetection.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index c5424be035..70c9e97c13 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -557,6 +557,12 @@
* Q_COMPILER_RESTRICTED_VLA variable-length arrays, prior to __cpp_runtime_arrays
*/
+#ifdef __cplusplus
+# if __cplusplus < 201103L && !(defined(Q_CC_MSVC) && Q_CC_MSVC >= 1800)
+# error Qt requires a C++11 compiler and yours does not seem to be that.
+# endif
+#endif
+
#ifdef Q_CC_INTEL
# define Q_COMPILER_RESTRICTED_VLA
# define Q_COMPILER_VARIADIC_MACROS // C++11 feature supported as an extension in other modes, too
@@ -1023,6 +1029,33 @@
// critical definitions. (Reported as Intel Issue ID 6000117277)
# define __USE_CONSTEXPR 1
# define __USE_NOEXCEPT 1
+# elif defined(Q_CC_MSVC) && (defined(Q_CC_CLANG) || defined(Q_CC_INTEL))
+// Clang and the Intel compiler support more C++ features than the Microsoft compiler
+// so make sure we don't enable them if the MS headers aren't properly adapted.
+# ifndef _HAS_CONSTEXPR
+# undef Q_COMPILER_CONSTEXPR
+# endif
+# ifndef _HAS_DECLTYPE
+# undef Q_COMPILER_DECLTYPE
+# endif
+# ifndef _HAS_INITIALIZER_LISTS
+# undef Q_COMPILER_INITIALIZER_LISTS
+# endif
+# ifndef _HAS_NULLPTR_T
+# undef Q_COMPILER_NULLPTR
+# endif
+# ifndef _HAS_RVALUE_REFERENCES
+# undef Q_COMPILER_RVALUE_REFS
+# endif
+# ifndef _HAS_SCOPED_ENUM
+# undef Q_COMPILER_CLASS_ENUM
+# endif
+# ifndef _HAS_TEMPLATE_ALIAS
+# undef Q_COMPILER_TEMPLATE_ALIAS
+# endif
+# ifndef _HAS_VARIADIC_TEMPLATES
+# undef Q_COMPILER_VARIADIC_TEMPLATES
+# endif
# elif defined(_LIBCPP_VERSION)
// libc++ uses __has_feature(cxx_atomic), so disable the feature if the compiler
// doesn't support it. That's required for the Intel compiler 14.x or earlier on OS X, for example.