Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2773)

Unified Diff: base/callback.h

Issue 2583343002: Mark OnceCallback::Run() & const so it matches a const callback object. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/bind_unittest.nc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/callback.h
diff --git a/base/callback.h b/base/callback.h
index 344acfe65cbb230abcfb74ba46c2d4bd7c8bd6f2..9bb0c0f6679dbd09d1e2cfcdd1d38ac85ec8f287 100644
--- a/base/callback.h
+++ b/base/callback.h
@@ -41,7 +41,7 @@ class RunMixin<OnceCallback<R(Args...)>> {
public:
using PolymorphicInvoke = R(*)(internal::BindStateBase*, Args&&...);
- R Run(Args... args) & {
+ R Run(Args... args) const & {
// Note: even though this static_assert will trivially always fail, it
// cannot be simply replaced with static_assert(false, ...) because:
// - Per [dcl.dcl]/p4, a program is ill-formed if the constant-expression
@@ -53,8 +53,8 @@ class RunMixin<OnceCallback<R(Args...)>> {
// to immediately reject static_assert(false, ...), even inside an
// uninstantiated template.
static_assert(!IsOnceCallback<CallbackType>::value,
- "OnceCallback::Run() may only be invoked on an rvalue, i.e. "
- "std::move(callback).Run().");
+ "OnceCallback::Run() may only be invoked on a non-const "
+ "rvalue, i.e. std::move(callback).Run().");
}
R Run(Args... args) && {
« no previous file with comments | « base/bind_unittest.nc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698