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

Unified Diff: base/bind_unittest.nc

Issue 2352853002: Disallow redundant Bind calls. (Closed)
Patch Set: static_assert message tweak Created 4 years, 3 months 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.cc ('k') | chrome/browser/extensions/api/dial/dial_service.cc » ('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 e60de076b58c9686a679f02c6a43e0a67d87eaf6..fdbbbbcd0c8c1283c7b3fc332b12ac201124952a 100644
--- a/base/bind_unittest.nc
+++ b/base/bind_unittest.nc
@@ -5,6 +5,8 @@
// This is a "No Compile Test" suite.
// http://dev.chromium.org/developers/testing/no-compile-tests
+#include <utility>
+
#include "base/bind.h"
#include "base/callback.h"
#include "base/macros.h"
@@ -208,6 +210,20 @@ void WontCompile() {
Bind([i]() {});
}
+#elif defined(NCTEST_DISALLOW_BINDING_ONCE_CALLBACK_WITH_NO_ARGS) // [r"static_assert failed \"Attempting to bind a base::Callback with no additional arguments: save a heap allocation and use the original base::Callback object\""]
+
+void WontCompile() {
+ internal::OnceClosure cb = internal::BindOnce([] {});
+ internal::OnceClosure cb2 = internal::BindOnce(std::move(cb));
+}
+
+#elif defined(NCTEST_DISALLOW_BINDING_REPEATING_CALLBACK_WITH_NO_ARGS) // [r"static_assert failed \"Attempting to bind a base::Callback with no additional arguments: save a heap allocation and use the original base::Callback object\""]
+
+void WontCompile() {
+ Closure cb = Bind([] {});
+ Closure cb2 = Bind(cb);
+}
+
#endif
} // namespace base
« no previous file with comments | « base/bind_unittest.cc ('k') | chrome/browser/extensions/api/dial/dial_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698