Skip to content

Commit

Permalink
Remove ABSL_HARDENING_ASSERT in AnyInvocable to avoid performance imp…
Browse files Browse the repository at this point in the history
…act in optimized builds

PiperOrigin-RevId: 531301442
Change-Id: Ib5a67f827bf89a66a0a8d24d3191f278566af6c8
  • Loading branch information
Abseil Team authored and netkex committed Apr 3, 2024
1 parent 48f5da2 commit ca28c59
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion absl/functional/any_invocable_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,7 @@ TYPED_TEST_P(AnyInvTestRvalue, NonConstCrashesOnSecondCall) {
// Ensure we're still valid
EXPECT_TRUE(static_cast<bool>(fun)); // NOLINT(bugprone-use-after-move)

#if !defined(NDEBUG) || ABSL_OPTION_HARDENED == 1
#if !defined(NDEBUG)
EXPECT_DEATH_IF_SUPPORTED(std::move(fun)(7, 8, 9), "");
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion absl/functional/internal/any_invocable.h
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ using CanAssignReferenceWrapper = TrueAlias<
auto* invoker = this->invoker_; \
if (!std::is_const<QualifiedTestType>::value && \
std::is_rvalue_reference<QualifiedTestType>::value) { \
ABSL_HARDENING_ASSERT([this]() { \
ABSL_ASSERT([this]() { \
/* We checked that this isn't const above, so const_cast is safe */ \
const_cast<Impl*>(this)->invoker_ = InvokedAfterMove; \
return this->HasValue(); \
Expand Down

0 comments on commit ca28c59

Please sign in to comment.