| 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 "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 // WeakPtrs cannot be bound to methods with return types. | 187 // WeakPtrs cannot be bound to methods with return types. |
| 188 void WontCompile() { | 188 void WontCompile() { |
| 189 NoRef no_ref; | 189 NoRef no_ref; |
| 190 WeakPtrFactory<NoRef> weak_factory(&no_ref); | 190 WeakPtrFactory<NoRef> weak_factory(&no_ref); |
| 191 Callback<int(void)> weak_ptr_with_non_void_return_type = | 191 Callback<int(void)> weak_ptr_with_non_void_return_type = |
| 192 Bind(&NoRef::IntMethod0, weak_factory.GetWeakPtr()); | 192 Bind(&NoRef::IntMethod0, weak_factory.GetWeakPtr()); |
| 193 weak_ptr_with_non_void_return_type.Run(); | 193 weak_ptr_with_non_void_return_type.Run(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 #elif defined(NCTEST_DISALLOW_ASSIGN_DIFFERENT_TYPES) // [r"fatal error: no via
ble conversion from 'Callback<typename internal::BindState<typename internal::Fu
nctorTraits<void \(\*\)\(int\)>::RunnableType, typename internal::FunctorTraits<
void \(\*\)\(int\)>::RunType, internal::TypeList<> >::UnboundRunType>' to 'Callb
ack<void \(\)>'"] | 196 #elif defined(NCTEST_DISALLOW_ASSIGN_DIFFERENT_TYPES) // [r"fatal error: no via
ble conversion from 'Callback<typename internal::BindState<typename internal::Fu
nctorTraits<void \(\*\)\(int\)>::RunnableType, typename internal::FunctorTraits<
void \(\*\)\(int\)>::RunType>::UnboundRunType>' to 'Callback<void \(\)>'"] |
| 197 | 197 |
| 198 // Bind result cannot be assigned to Callbacks with a mismatching type. | 198 // Bind result cannot be assigned to Callbacks with a mismatching type. |
| 199 void WontCompile() { | 199 void WontCompile() { |
| 200 Closure callback_mismatches_bind_type = Bind(&VoidPolymorphic1<int>); | 200 Closure callback_mismatches_bind_type = Bind(&VoidPolymorphic1<int>); |
| 201 } | 201 } |
| 202 | 202 |
| 203 #endif | 203 #endif |
| 204 | 204 |
| 205 } // namespace base | 205 } // namespace base |
| OLD | NEW |