| 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> |
| 9 |
| 8 #include "base/bind.h" | 10 #include "base/bind.h" |
| 9 #include "base/callback.h" | 11 #include "base/callback.h" |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 12 | 14 |
| 13 namespace base { | 15 namespace base { |
| 14 | 16 |
| 15 // Do not put everything inside an anonymous namespace. If you do, many of the | 17 // Do not put everything inside an anonymous namespace. If you do, many of the |
| 16 // helper function declarations will generate unused definition warnings. | 18 // helper function declarations will generate unused definition warnings. |
| 17 | 19 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 Closure callback_mismatches_bind_type = Bind(&VoidPolymorphic1<int>); | 203 Closure callback_mismatches_bind_type = Bind(&VoidPolymorphic1<int>); |
| 202 } | 204 } |
| 203 | 205 |
| 204 #elif defined(NCTEST_DISALLOW_CAPTURING_LAMBDA) // [r"fatal error: implicit ins
tantiation of undefined template 'base::internal::FunctorTraits<\(lambda at ../.
./base/bind_unittest.nc:[0-9]+:[0-9]+\), void>'"] | 206 #elif defined(NCTEST_DISALLOW_CAPTURING_LAMBDA) // [r"fatal error: implicit ins
tantiation of undefined template 'base::internal::FunctorTraits<\(lambda at ../.
./base/bind_unittest.nc:[0-9]+:[0-9]+\), void>'"] |
| 205 | 207 |
| 206 void WontCompile() { | 208 void WontCompile() { |
| 207 int i = 0; | 209 int i = 0; |
| 208 Bind([i]() {}); | 210 Bind([i]() {}); |
| 209 } | 211 } |
| 210 | 212 |
| 213 #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\""] |
| 214 |
| 215 void WontCompile() { |
| 216 internal::OnceClosure cb = internal::BindOnce([] {}); |
| 217 internal::OnceClosure cb2 = internal::BindOnce(std::move(cb)); |
| 218 } |
| 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\""] |
| 221 |
| 222 void WontCompile() { |
| 223 Closure cb = Bind([] {}); |
| 224 Closure cb2 = Bind(cb); |
| 225 } |
| 226 |
| 211 #endif | 227 #endif |
| 212 | 228 |
| 213 } // namespace base | 229 } // namespace base |
| OLD | NEW |