diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index 2165c56d3c9..6c86c47caac 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -122,12 +122,12 @@ namespace { struct DiRegKeyHandleTraits { using Type = HKEY; - static Type invalidValue() + static Type invalidValue() noexcept { // The setupapi.h functions return INVALID_HANDLE_VALUE when failing to open a registry key return reinterpret_cast(INVALID_HANDLE_VALUE); } - static bool close(Type handle) { return RegCloseKey(handle) == ERROR_SUCCESS; } + static bool close(Type handle) noexcept { return RegCloseKey(handle) == ERROR_SUCCESS; } }; using DiRegKeyHandle = QUniqueHandle; @@ -135,11 +135,11 @@ using DiRegKeyHandle = QUniqueHandle; struct DevInfoHandleTraits { using Type = HDEVINFO; - static Type invalidValue() + static Type invalidValue() noexcept { return reinterpret_cast(INVALID_HANDLE_VALUE); } - static bool close(Type handle) { return SetupDiDestroyDeviceInfoList(handle) == TRUE; } + static bool close(Type handle) noexcept { return SetupDiDestroyDeviceInfoList(handle) == TRUE; } }; using DevInfoHandle = QUniqueHandle; diff --git a/tests/auto/corelib/tools/quniquehandle/tst_quniquehandle.cpp b/tests/auto/corelib/tools/quniquehandle/tst_quniquehandle.cpp index bc8f4685610..55647f3ee4b 100644 --- a/tests/auto/corelib/tools/quniquehandle/tst_quniquehandle.cpp +++ b/tests/auto/corelib/tools/quniquehandle/tst_quniquehandle.cpp @@ -76,7 +76,7 @@ struct TestTraits { using Type = GlobalResource::handle; - static bool close(Type handle) + static bool close(Type handle) noexcept { return GlobalResource::close(handle); } @@ -267,7 +267,7 @@ private slots: { using Type = int; - static bool close(Type) + static bool close(Type) noexcept { return true; }