Skip to content

Commit 3deb508

Browse files
authored
check_bool<T> now returns T (#1205)
1 parent 6d3609a commit 3deb508

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

strings/base_error.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,12 +619,14 @@ WINRT_EXPORT namespace winrt
619619
}
620620

621621
template<typename T>
622-
void check_bool(T result WINRT_IMPL_SOURCE_LOCATION_ARGS)
622+
T check_bool(T result WINRT_IMPL_SOURCE_LOCATION_ARGS)
623623
{
624624
if (!result)
625625
{
626626
winrt::throw_last_error(WINRT_IMPL_SOURCE_LOCATION_FORWARD_SINGLE_PARAM);
627627
}
628+
629+
return result;
628630
}
629631

630632
template<typename T>

test/old_tests/UnitTests/Errors.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ TEST_CASE("Errors")
200200
SetLastError(ERROR_CANCELLED);
201201
REQUIRE_THROWS_AS(check_bool(static_cast<BOOL>(false)), hresult_canceled);
202202

203+
REQUIRE(check_bool(true) == true);
204+
203205
// Support for Win32 errors.
204206
check_win32(ERROR_SUCCESS);
205207
REQUIRE_THROWS_AS(check_win32(ERROR_CANCELLED), hresult_canceled);

0 commit comments

Comments
 (0)