id summary reporter owner description type status milestone component version severity resolution keywords cc 8925 libs/log/src/event.cpp: might not retireve last error correctly Jeffrey Walton Andrey Semashev "The following code may not retrieve the last error correctly. if (WaitForSingleObject(m_event, INFINITE) != 0) { BOOST_THROW_EXCEPTION(system::system_error( GetLastError(), system::system_category(), ""Failed to block on Windows event"")); } If the compile evaluates the args in BOOST_THROW_EXCEPTION from left to right, system::system_error could call on a Win32 API that blows away the error. Conversely, if the args are evaluated right to left, then system::system_category() or the ""Failed to block on Windows event"" string could cause last error to get blown away. My apologies for the write-up. After looking at a number of uses of WaitForSingleObject in Boost, this is one of the few (fewer than 5) that is correct. Perhaps something like below would be easier to audit for correctness: if (WaitForSingleObject(m_event, INFINITE) != 0) { DWORD dwError = GetLastError(); BOOST_THROW_EXCEPTION(system::system_error( dwError, system::system_category(), ""Failed to block on Windows event"")); }" Bugs closed To Be Determined log Boost 1.54.0 Problem fixed GetLastError Win32 API failure