Make warning about wrapping empty std::function in AnyInvocable stronger.
PiperOrigin-RevId: 733331540
Change-Id: Ia77f89dfbd58fa2845c89af68976b965852d7e18
diff --git a/absl/functional/any_invocable.h b/absl/functional/any_invocable.h
index 6a7cf64..43ea9af 100644
--- a/absl/functional/any_invocable.h
+++ b/absl/functional/any_invocable.h
@@ -279,11 +279,10 @@
//
// WARNING: An `AnyInvocable` that wraps an empty `std::function` is not
// itself empty. This behavior is consistent with the standard equivalent
- // `std::move_only_function`.
- //
- // In other words:
+ // `std::move_only_function`. In the following example, `a()` will actually
+ // invoke `f()`, leading to an `std::bad_function_call` exception:
// std::function<void()> f; // empty
- // absl::AnyInvocable<void()> a = std::move(f); // not empty
+ // absl::AnyInvocable<void()> a = f; // not empty
//
// Invoking an empty `AnyInvocable` results in undefined behavior.
explicit operator bool() const noexcept { return this->HasValue(); }