Skip to content

Commit

Permalink
Constexpr check for AsyncGenerator's cleanup
Browse files Browse the repository at this point in the history
Summary:
With MSVC 19.35 C++20 /O2, the check spuriously fails.
As this is a template parameter, the check can be lifted to the compile
time for the particular type. This seems to mitigate the spurious failures.

Reviewed By: Orvid, michalkielan

Differential Revision: D51098782

fbshipit-source-id: c36a1d201c6e51a19ac2a7b0737941ccb79e614d
  • Loading branch information
Deniz Evrenci authored and facebook-github-bot committed Nov 9, 2023
1 parent cb336bf commit b17b880
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion folly/experimental/coro/AsyncGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ class FOLLY_NODISCARD AsyncGenerator {

~AsyncGenerator() {
if (coro_) {
CHECK(!RequiresCleanup) << "cleanup() hasn't been called!";
if constexpr (RequiresCleanup) {
LOG(FATAL) << "cleanup() hasn't been called!";
}

coro_.destroy();
}
}
Expand Down

0 comments on commit b17b880

Please sign in to comment.