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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 #elif defined(NCTEST_DISALLOW_ASSIGN_DIFFERENT_TYPES) // [r"fatal error: no via
ble conversion from 'Callback<MakeUnboundRunType<void \(\*\)\(int\)>>' to 'Callb
ack<void \(\)>'"] | 199 #elif defined(NCTEST_DISALLOW_ASSIGN_DIFFERENT_TYPES) // [r"fatal error: no via
ble conversion from 'Callback<MakeUnboundRunType<void \(\*\)\(int\)>>' to 'Callb
ack<void \(\)>'"] |
200 | 200 |
201 // Bind result cannot be assigned to Callbacks with a mismatching type. | 201 // Bind result cannot be assigned to Callbacks with a mismatching type. |
202 void WontCompile() { | 202 void WontCompile() { |
203 Closure callback_mismatches_bind_type = Bind(&VoidPolymorphic1<int>); | 203 Closure callback_mismatches_bind_type = Bind(&VoidPolymorphic1<int>); |
204 } | 204 } |
205 | 205 |
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>'"] | 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>'"] |
207 | 207 |
208 void WontCompile() { | 208 void WontCompile() { |
209 int i = 0; | 209 int i = 0, j = 0; |
210 Bind([i]() {}); | 210 Bind([i,&j]() {j = i;}); |
211 } | 211 } |
212 | 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\""] | 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 | 214 |
215 void WontCompile() { | 215 void WontCompile() { |
216 OnceClosure cb = BindOnce([] {}); | 216 OnceClosure cb = BindOnce([] {}); |
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\""] |
(...skipping 20 matching lines...) Expand all Loading... |
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\(\)\.\""] | 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 | 242 |
243 void WontCompile() { | 243 void WontCompile() { |
244 const OnceClosure cb = Bind([] {}); | 244 const OnceClosure cb = Bind([] {}); |
245 std::move(cb).Run(); | 245 std::move(cb).Run(); |
246 } | 246 } |
247 | 247 |
248 #endif | 248 #endif |
249 | 249 |
250 } // namespace base | 250 } // namespace base |
OLD | NEW |