diff --git a/src/corelib/tools/qpair.h b/src/corelib/tools/qpair.h index d637067fa8..b21750f76c 100644 --- a/src/corelib/tools/qpair.h +++ b/src/corelib/tools/qpair.h @@ -46,30 +46,36 @@ struct QPair typedef T2 second_type; Q_DECL_CONSTEXPR QPair() - Q_DECL_NOEXCEPT_EXPR(noexcept(T1()) && noexcept(T2())) + Q_DECL_NOEXCEPT_EXPR((std::is_nothrow_default_constructible::value && + std::is_nothrow_default_constructible::value)) : first(), second() {} Q_DECL_CONSTEXPR QPair(const T1 &t1, const T2 &t2) - Q_DECL_NOEXCEPT_EXPR(noexcept(T1(t1)) && noexcept(T2(t2))) + Q_DECL_NOEXCEPT_EXPR((std::is_nothrow_copy_constructible::value && + std::is_nothrow_copy_constructible::value)) : first(t1), second(t2) {} // compiler-generated copy/move ctor/assignment operators are fine! template Q_DECL_CONSTEXPR QPair(const QPair &p) - Q_DECL_NOEXCEPT_EXPR(noexcept(T1(p.first)) && noexcept(T2(p.second))) + Q_DECL_NOEXCEPT_EXPR((std::is_nothrow_constructible::value && + std::is_nothrow_constructible::value)) : first(p.first), second(p.second) {} template Q_DECL_RELAXED_CONSTEXPR QPair &operator=(const QPair &p) - Q_DECL_NOEXCEPT_EXPR(noexcept(std::declval() = p.first) && noexcept(std::declval() = p.second)) + Q_DECL_NOEXCEPT_EXPR((std::is_nothrow_assignable::value && + std::is_nothrow_assignable::value)) { first = p.first; second = p.second; return *this; } #ifdef Q_COMPILER_RVALUE_REFS template Q_DECL_CONSTEXPR QPair(QPair &&p) + Q_DECL_NOEXCEPT_EXPR((std::is_nothrow_constructible::value && + std::is_nothrow_constructible::value)) // can't use std::move here as it's not constexpr in C++11: - Q_DECL_NOEXCEPT_EXPR(noexcept(T1(static_cast(p.first))) && noexcept(T2(static_cast(p.second)))) : first(static_cast(p.first)), second(static_cast(p.second)) {} template Q_DECL_RELAXED_CONSTEXPR QPair &operator=(QPair &&p) - Q_DECL_NOEXCEPT_EXPR(noexcept(std::declval() = std::move(p.first)) && noexcept(std::declval() = std::move(p.second))) + Q_DECL_NOEXCEPT_EXPR((std::is_nothrow_assignable::value && + std::is_nothrow_assignable::value)) { first = std::move(p.first); second = std::move(p.second); return *this; } #endif