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>
This commit is contained in:
Thiago Macieira 2014-06-19 16:51:17 -07:00
parent 53262b9b5b
commit 7ab6f24ac1

View File

@ -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 */