diff --git a/src/corelib/global/qswap.h b/src/corelib/global/qswap.h index 7feff5eb08..8ea0d3a16f 100644 --- a/src/corelib/global/qswap.h +++ b/src/corelib/global/qswap.h @@ -7,6 +7,7 @@ #include #include +#include #include #if 0 @@ -20,20 +21,9 @@ QT_WARNING_PUSH // warning: noexcept-expression evaluates to 'false' because of a call to 'void swap(..., ...)' QT_WARNING_DISABLE_GCC("-Wnoexcept") -namespace QtPrivate -{ -namespace SwapExceptionTester { // insulate users from the "using std::swap" below - using std::swap; // import std::swap - template - void checkSwap(T &t) - noexcept(noexcept(swap(t, t))); - // declared, but not implemented (only to be used in unevaluated contexts (noexcept operator)) -} -} // namespace QtPrivate - template constexpr void qSwap(T &value1, T &value2) - noexcept(noexcept(QtPrivate::SwapExceptionTester::checkSwap(value1))) + noexcept(std::is_nothrow_swappable_v) { using std::swap; swap(value1, value2);