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\(\)\.\""] | 227 #elif defined(NCTEST_DISALLOW_ONCECALLBACK_RUN_ON_LVALUE) // [r"static_assert f
ailed \"OnceCallback::Run\(\) may only be invoked on a non-const rvalue, i\.e\.
std::move\(callback\)\.Run\(\)\.\""] |
228 | 228 |
229 void WontCompile() { | 229 void WontCompile() { |
230 OnceClosure cb = Bind([] {}); | 230 OnceClosure cb = Bind([] {}); |
231 cb.Run(); | 231 cb.Run(); |
232 } | 232 } |
233 | 233 |
| 234 #elif defined(NCTEST_DISALLOW_ONCECALLBACK_RUN_ON_CONST_LVALUE) // [r"static_as
sert failed \"OnceCallback::Run\(\) may only be invoked on a non-const rvalue, i
\.e\. std::move\(callback\)\.Run\(\)\.\""] |
| 235 |
| 236 void WontCompile() { |
| 237 const OnceClosure cb = Bind([] {}); |
| 238 cb.Run(); |
| 239 } |
| 240 |
| 241 #elif defined(NCTEST_DISALLOW_ONCECALLBACK_RUN_ON_CONST_RVALUE) // [r"static_as
sert failed \"OnceCallback::Run\(\) may only be invoked on a non-const rvalue, i
\.e\. std::move\(callback\)\.Run\(\)\.\""] |
| 242 |
| 243 void WontCompile() { |
| 244 const OnceClosure cb = Bind([] {}); |
| 245 std::move(cb).Run(); |
| 246 } |
| 247 |
234 #endif | 248 #endif |
235 | 249 |
236 } // namespace base | 250 } // namespace base |
OLD | NEW |