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

Unified Diff: base/bind_unittest.nc

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 | « no previous file | base/callback.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/bind_unittest.nc
diff --git a/base/bind_unittest.nc b/base/bind_unittest.nc
index 46468eca3b99f32bf26422961cd04c0d380f22bb..24a345d260ff3f9f30aae7db0776c589f6a4b792 100644
--- a/base/bind_unittest.nc
+++ b/base/bind_unittest.nc
@@ -224,13 +224,27 @@ void WontCompile() {
Closure cb2 = Bind(cb);
}
-#elif defined(NCTEST_DISALLOW_ONCECALLBACK_RUN_ON_LVALUE) // [r"static_assert failed \"OnceCallback::Run\(\) may only be invoked on an rvalue, i\.e\. std::move\(callback\)\.Run\(\)\.\""]
+#elif defined(NCTEST_DISALLOW_ONCECALLBACK_RUN_ON_LVALUE) // [r"static_assert failed \"OnceCallback::Run\(\) may only be invoked on a non-const rvalue, i\.e\. std::move\(callback\)\.Run\(\)\.\""]
void WontCompile() {
OnceClosure cb = Bind([] {});
cb.Run();
}
+#elif defined(NCTEST_DISALLOW_ONCECALLBACK_RUN_ON_CONST_LVALUE) // [r"static_assert failed \"OnceCallback::Run\(\) may only be invoked on a non-const rvalue, i\.e\. std::move\(callback\)\.Run\(\)\.\""]
+
+void WontCompile() {
+ const OnceClosure cb = Bind([] {});
+ cb.Run();
+}
+
+#elif defined(NCTEST_DISALLOW_ONCECALLBACK_RUN_ON_CONST_RVALUE) // [r"static_assert failed \"OnceCallback::Run\(\) may only be invoked on a non-const rvalue, i\.e\. std::move\(callback\)\.Run\(\)\.\""]
+
+void WontCompile() {
+ const OnceClosure cb = Bind([] {});
+ std::move(cb).Run();
+}
+
#endif
} // namespace base
« no previous file with comments | « no previous file | base/callback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698