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

Unified Diff: base/bind_unittest.nc

Issue 2517793002: Improve compile error when invoking OnceCallback::Run on a non-rvalue. (Closed)
Patch Set: Add C++ language lawyering explanation. Created 4 years, 1 month 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') | base/callback.h » ('J')
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 bba2e025f2c47ab604cb236cadf3361dbc814213..46468eca3b99f32bf26422961cd04c0d380f22bb 100644
--- a/base/bind_unittest.nc
+++ b/base/bind_unittest.nc
@@ -224,6 +224,13 @@ 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\(\)\.\""]
+
+void WontCompile() {
+ OnceClosure cb = Bind([] {});
+ cb.Run();
+}
+
#endif
} // namespace base
« no previous file with comments | « no previous file | base/callback.h » ('j') | base/callback.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698