Skip to content
This repository was archived by the owner on Jun 15, 2025. It is now read-only.

Commit 9d75dfe

Browse files
authored
Require explicit static_cast for GetLastError
Using GetLastError() with std::error_code requires an explicit cast. Only caught by MinGW...
1 parent 58ad2a1 commit 9d75dfe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/spsl/compat.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ inline void lockMemory(void* addr, std::size_t len, std::error_code* ec = nullpt
111111
{
112112
if (VirtualLock(addr, len) == 0)
113113
{
114-
std::error_code err(GetLastError(), std::system_category());
114+
std::error_code err(static_cast<int>(GetLastError()), std::system_category());
115115
if (ec)
116116
*ec = err;
117117
else
@@ -123,7 +123,7 @@ inline void unlockMemory(void* addr, std::size_t len, std::error_code* ec = null
123123
{
124124
if (VirtualUnlock(addr, len) == 0)
125125
{
126-
std::error_code err(GetLastError(), std::system_category());
126+
std::error_code err(static_cast<int>(GetLastError()), std::system_category());
127127
if (ec)
128128
*ec = err;
129129
else

0 commit comments

Comments
 (0)