diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2014-06-19 16:51:17 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2014-06-25 16:52:10 +0200 |
commit | 7ab6f24ac1f0b5877356f4781827bc8f65bbcdcf (patch) | |
tree | 42cd8da26883f21f86bb4afa5b0c26817d902e7d /src/corelib/global | |
parent | 53262b9b5b9cb536916f6d6e086a944cb17bb8d8 (diff) |
Update MSVC compiler features according to testing
Looks like a few extra features have been supported for a while and we
had never noticed. That includes the C++98 template friends, C++11
extern templates and C++11 nullptr. They've been supported since at
least MSVC 2010, possibly even earlier, but I don't have MSVC 2008 to
test with.
Testing also indicates that MSVC 2012 and 2013 have a bug in their
support for the range for construct. The following code fails to
compile:
for (int i : l)
do { (void)0; } while (0);
test.cpp(2) : error C2059: syntax error : '}'
Reported as https://connect.microsoft.com/VisualStudio/feedback/details/903999/c-11-range-for-construct-fails-to-compile-when-body-is-a-do-while-block
Change-Id: I5d0156f4c847c45fa1f6f5b9ee4ddbdacb8ab59b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r-- | src/corelib/global/qcompilerdetection.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index afbbaf8f2d..3cd757c14f 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -89,7 +89,9 @@ # define Q_CC_MSVC # define Q_CC_MSVC_NET # define Q_OUTOFLINE_TEMPLATE inline -# define Q_NO_TEMPLATE_FRIENDS +# if _MSC_VER < 1600 +# define Q_NO_TEMPLATE_FRIENDS +# endif # define Q_COMPILER_MANGLES_RETURN_TYPE # define Q_FUNC_INFO __FUNCSIG__ # define Q_ALIGNOF(type) __alignof(type) @@ -808,8 +810,10 @@ /* C++11 features supported in VC10 = VC2010: */ # define Q_COMPILER_AUTO_FUNCTION # define Q_COMPILER_AUTO_TYPE -# define Q_COMPILER_LAMBDA # define Q_COMPILER_DECLTYPE +# define Q_COMPILER_EXTERN_TEMPLATES +# define Q_COMPILER_LAMBDA +# define Q_COMPILER_NULLPTR # define Q_COMPILER_RVALUE_REFS # define Q_COMPILER_STATIC_ASSERT // MSVC's library has std::initializer_list, but the compiler does not support the braces initialization @@ -821,7 +825,6 @@ # undef Q_DECL_OVERRIDE /* undo 2005/2008 settings... */ # undef Q_DECL_FINAL /* undo 2005/2008 settings... */ # define Q_COMPILER_EXPLICIT_OVERRIDES /* ...and use std C++11 now */ -# define Q_COMPILER_RANGE_FOR # define Q_COMPILER_CLASS_ENUM # define Q_COMPILER_ATOMICS # endif /* VC 11 */ |