Skip to content

Commit e331996

Browse files
Fix incompatibility with C++14. (#615)
* Fix incompatibility with C++14. `std::scoped_lock` is available in C++17. Using it without a feature guard causes compile errors on earlier C++ versions. * Update include/wil/resource.h Co-authored-by: Duncan Horn <40036384+dunhor@users.noreply.github.com> --------- Co-authored-by: Duncan Horn <40036384+dunhor@users.noreply.github.com>
1 parent 0bd7bf2 commit e331996

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

include/wil/resource.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4987,7 +4987,7 @@ struct hlocal_secure_deleter
49874987
{
49884988
if (ptr)
49894989
{
4990-
#pragma warning(suppress : 26006 26007) // LocalSize() ensures proper buffer length
4990+
#pragma warning(suppress : 26006 26007) // LocalSize() ensures proper buffer length
49914991
::SecureZeroMemory(ptr, ::LocalSize(ptr)); // this is safe since LocalSize() returns 0 on failure
49924992
::LocalFree(ptr);
49934993
}
@@ -8322,10 +8322,12 @@ namespace details
83228322
{
83238323
};
83248324

8325+
#if __cpp_lib_scoped_lock >= 201703L
83258326
template <typename TMutex>
83268327
struct lock_proof_traits<std::scoped_lock<TMutex>> : exclusive_lock_proof
83278328
{
83288329
};
8330+
#endif
83298331
} // namespace details
83308332
/// @endcond
83318333

0 commit comments

Comments
 (0)