diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2014-08-23 18:34:02 +0200 |
---|---|---|
committer | Olivier Goffart <ogoffart@woboq.com> | 2014-10-31 09:54:15 +0100 |
commit | 6700fb0bf0bc1be7346c8184b7c112c574ba6515 (patch) | |
tree | 205f33701ea19b0f56c38cf2f77ec861618b6d9b /tests/auto/corelib/global | |
parent | 053e8c41d7f87a07cb1a74cd95bd030ac138dc4e (diff) | |
download | qtbase-6700fb0bf0bc1be7346c8184b7c112c574ba6515.tar.gz |
Use Q_DECL_RELAXED_CONSTEXPR in QFlags
Change-Id: I91073f4bb71e554402fc13cbd0e9ba5b5b95bce0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/global')
-rw-r--r-- | tests/auto/corelib/global/qflags/qflags.pro | 1 | ||||
-rw-r--r-- | tests/auto/corelib/global/qflags/tst_qflags.cpp | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/corelib/global/qflags/qflags.pro b/tests/auto/corelib/global/qflags/qflags.pro index 9e80d5634b..3f78bc045b 100644 --- a/tests/auto/corelib/global/qflags/qflags.pro +++ b/tests/auto/corelib/global/qflags/qflags.pro @@ -3,3 +3,4 @@ TARGET = tst_qflags QT = core testlib SOURCES = tst_qflags.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 +contains(QT_CONFIG, c++11): CONFIG += c++11 c++14 diff --git a/tests/auto/corelib/global/qflags/tst_qflags.cpp b/tests/auto/corelib/global/qflags/tst_qflags.cpp index 4c74ac166b..15fe93298d 100644 --- a/tests/auto/corelib/global/qflags/tst_qflags.cpp +++ b/tests/auto/corelib/global/qflags/tst_qflags.cpp @@ -94,6 +94,16 @@ void tst_QFlags::testFlagMultiBits() const template <unsigned int N, typename T> bool verifyConstExpr(T n) { return n == N; } +Q_DECL_RELAXED_CONSTEXPR Qt::MouseButtons testRelaxedConstExpr() +{ + Qt::MouseButtons value; + value = Qt::LeftButton | Qt::RightButton; + value |= Qt::MiddleButton; + value &= ~Qt::LeftButton; + value ^= Qt::RightButton; + return value; +} + void tst_QFlags::constExpr() { #ifdef Q_COMPILER_CONSTEXPR @@ -115,6 +125,10 @@ void tst_QFlags::constExpr() QVERIFY(verifyConstExpr<Qt::MouseButtons(Qt::RightButton) | 0xff>(0xff)); QVERIFY(!verifyConstExpr<Qt::RightButton>(!Qt::MouseButtons(Qt::LeftButton))); + +#if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304 + QVERIFY(verifyConstExpr<testRelaxedConstExpr()>(Qt::MiddleButton)); +#endif #endif } |