qcompilerdetection.h: retract Q_COMPILER_DEFAULT_MEMBERS for MSVC < 2015

Earlier versions of the compiler cannot default
move special member functions, even though we
also define Q_COMPILER_RVALUE_REFS for them.

Fix by retracting the less-often-used of the
two compiler feature defines.

Q_COMPILER_DEFAULT_MEMBERS is not used outside
QtBase in neither 5.6 nor 5.7 (5.8 is not
released at this time, so wasn't considered).
The same is true of the dependent macros
Q_COMPILER_DEFAULT_DELETE_MEMBERS and
Q_DECL_EQ_DEFAULT.

In QtBase, the three uses are:
1. in QAtomic*, where the user also requires
   Q_COMPILER_CONSTEXPR, which is not defined
   for any MSVC at this time,
2. for QEnableSharedFromThis, which is a class
   template with an alternative {} implementa-
   tion of the default constructor, and uncon-
   ditional user-defined copy special member
   functions.
3. The test of the corresponding functionality
   in tst_compiler, which this commit amends.

That means that neither of these two only uses
of the macro in Qt libraries are affected by
the change.

The reason we do this change, then, is that in
the future, we want to be able to more easily
restore move special member functions for
classes for which they are suppressed due to
user-defined dtors or copy special member
functions.

Change-Id: I6f88cad66d6b87a758231f16355c3bddae697b86
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Marc Mutz 2016-09-01 08:27:57 +02:00
parent 312d08b290
commit 2a6bea7a55
2 changed files with 7 additions and 2 deletions

View File

@ -887,7 +887,8 @@
# endif /* VC 11 */
# if _MSC_VER >= 1800
/* C++11 features in VC12 = VC2013 */
# define Q_COMPILER_DEFAULT_MEMBERS
/* Implemented, but can't be used on move special members */
/* # define Q_COMPILER_DEFAULT_MEMBERS */
# define Q_COMPILER_DELETE_MEMBERS
# define Q_COMPILER_DELEGATING_CONSTRUCTORS
# define Q_COMPILER_EXPLICIT_CONVERSIONS
@ -905,6 +906,7 @@
# endif /* VC 12 SP 2 RC */
# if _MSC_VER >= 1900
/* C++11 features in VC14 = VC2015 */
# define Q_COMPILER_DEFAULT_MEMBERS
# define Q_COMPILER_ALIGNAS
# define Q_COMPILER_ALIGNOF
// Partial support, insufficient for Qt

View File

@ -875,11 +875,14 @@ void tst_Compiler::cxx11_default_members()
};
class DefaultMembersChild: public DefaultMembers
{
DefaultMembersChild(const DefaultMembersChild &) : DefaultMembers() {}
public:
DefaultMembersChild():DefaultMembers() {};
DefaultMembersChild(DefaultMembersChild &&) = default;
};
DefaultMembersChild dm;
Q_UNUSED(dm);
DefaultMembersChild dm2 = std::move(dm);
Q_UNUSED(dm2);
#endif
}