summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/global/qcompilerdetection.h7
-rw-r--r--tests/auto/other/compiler/tst_compiler.cpp15
2 files changed, 17 insertions, 5 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index ac60d47c7e..8e52c50322 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -730,8 +730,6 @@
/* C++11 features supported in GCC 4.4: */
# define Q_COMPILER_AUTO_FUNCTION
# define Q_COMPILER_AUTO_TYPE
-# define Q_COMPILER_DEFAULT_MEMBERS
-# define Q_COMPILER_DELETE_MEMBERS
# define Q_COMPILER_EXTERN_TEMPLATES
# define Q_COMPILER_UNIFORM_INIT
# define Q_COMPILER_UNICODE_STRINGS
@@ -748,6 +746,11 @@
# define Q_COMPILER_CLASS_ENUM
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
+ /* Pre-4.6 compilers implement a non-final snapshot of N2346, hence default and delete
+ * functions are supported only if they are public. Starting from 4.6, GCC handles
+ * final version - the access modifier is not relevant. */
+# define Q_COMPILER_DEFAULT_MEMBERS
+# define Q_COMPILER_DELETE_MEMBERS
/* C++11 features supported in GCC 4.6: */
# define Q_COMPILER_CONSTEXPR
# define Q_COMPILER_NULLPTR
diff --git a/tests/auto/other/compiler/tst_compiler.cpp b/tests/auto/other/compiler/tst_compiler.cpp
index 47345bfc43..8253a283f5 100644
--- a/tests/auto/other/compiler/tst_compiler.cpp
+++ b/tests/auto/other/compiler/tst_compiler.cpp
@@ -784,12 +784,19 @@ void tst_Compiler::cxx11_default_members()
#ifndef Q_COMPILER_DEFAULT_MEMBERS
QSKIP("Compiler does not support C++11 feature");
#else
- struct DefaultMembers
+ class DefaultMembers
{
+ protected:
DefaultMembers() = default;
+ public:
DefaultMembers(int) {}
};
- DefaultMembers dm;
+ class DefaultMembersChild: public DefaultMembers
+ {
+ public:
+ DefaultMembersChild():DefaultMembers() {};
+ };
+ DefaultMembersChild dm;
Q_UNUSED(dm);
#endif
}
@@ -799,9 +806,11 @@ void tst_Compiler::cxx11_delete_members()
#ifndef Q_COMPILER_DELETE_MEMBERS
QSKIP("Compiler does not support C++11 feature");
#else
- struct DeleteMembers
+ class DeleteMembers
{
+ protected:
DeleteMembers() = delete;
+ public:
DeleteMembers(const DeleteMembers &) = delete;
~DeleteMembers() = delete;
};