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

Side by Side Diff: base/bind_unittest.nc

Issue 2517793002: Improve compile error when invoking OnceCallback::Run on a non-rvalue. (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | base/callback.h » ('j') | base/callback.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This is a "No Compile Test" suite. 5 // This is a "No Compile Test" suite.
6 // http://dev.chromium.org/developers/testing/no-compile-tests 6 // http://dev.chromium.org/developers/testing/no-compile-tests
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 OnceClosure cb2 = BindOnce(std::move(cb)); 217 OnceClosure cb2 = BindOnce(std::move(cb));
218 } 218 }
219 219
220 #elif defined(NCTEST_DISALLOW_BINDING_REPEATING_CALLBACK_WITH_NO_ARGS) // [r"st atic_assert failed \"Attempting to bind a base::Callback with no additional argu ments: save a heap allocation and use the original base::Callback object\""] 220 #elif defined(NCTEST_DISALLOW_BINDING_REPEATING_CALLBACK_WITH_NO_ARGS) // [r"st atic_assert failed \"Attempting to bind a base::Callback with no additional argu ments: save a heap allocation and use the original base::Callback object\""]
221 221
222 void WontCompile() { 222 void WontCompile() {
223 Closure cb = Bind([] {}); 223 Closure cb = Bind([] {});
224 Closure cb2 = Bind(cb); 224 Closure cb2 = Bind(cb);
225 } 225 }
226 226
227 #elif defined(NCTEST_DISALLOW_ONCECALLBACK_RUN_ON_LVALUE) // [r"static_assert f ailed \"OnceCallback::Run\(\) may only be invoked on an rvalue, i\.e\. std::move \(callback\)\.Run\(\)\.\""]
228
229 void WontCompile() {
230 OnceClosure cb = Bind([] {});
231 cb.Run();
dcheng 2016/11/19 08:07:59 I could put this in callback_unittest.nc as well,
232 }
233
227 #endif 234 #endif
228 235
229 } // namespace base 236 } // namespace base
OLDNEW
« 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