Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 |
| OLD | NEW |