From c44e3b119af7d306378f3a9085d084c0b7cd21e0 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 6 Sep 2021 17:22:34 +0200 Subject: [PATCH] Add a conditional noexcept specification to qExchange Following P2401 (which libstdc++ and MS-STL already implement) and [res.on.exception.handling]/5 that gives us freedom to strenghten any noexcept specification. Change-Id: I17ebd9148a181eb8496ace3a9d8010008160b564 Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 6467ba1984..3fabac3888 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1204,6 +1204,7 @@ void qAsConst(const T &&) = delete; // like std::exchange template constexpr T qExchange(T &t, U &&newValue) +noexcept(std::conjunction_v, std::is_nothrow_assignable>) { T old = std::move(t); t = std::forward(newValue);