Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: base/callback_unittest.nc

Issue 1699773002: Extend base::Callback to have a move-only variant (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/callback_internal.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 9
10 namespace base { 10 namespace base {
11 11
12 class Parent { 12 class Parent {
13 }; 13 };
14 14
15 class Child : Parent { 15 class Child : Parent {
16 }; 16 };
17 17
18 #if defined(NCTEST_EQUALS_REQUIRES_SAMETYPE) // [r"fatal error: no viable conve rsion from 'Callback<int \(\)>' to 'const Callback<void \(\)>'"] 18 #if defined(NCTEST_EQUALS_REQUIRES_SAMETYPE) // [r"fatal error: no viable conve rsion from 'Callback<int \(\), \[\.\.\.\]>' to 'const Callback<void \(\), \[\.\. \.\]>'"]
19 19
20 // Attempting to call comparison function on two callbacks of different type. 20 // Attempting to call comparison function on two callbacks of different type.
21 // 21 //
22 // This should be a compile time failure because each callback type should be 22 // This should be a compile time failure because each callback type should be
23 // considered distinct. 23 // considered distinct.
24 void WontCompile() { 24 void WontCompile() {
25 Closure c1; 25 Closure c1;
26 Callback<int()> c2; 26 Callback<int()> c2;
27 c1.Equals(c2); 27 c1.Equals(c2);
28 } 28 }
(...skipping 15 matching lines...) Expand all
44 // See explanation for NCTEST_CONSTRUCTION_FROM_SUBTYPE 44 // See explanation for NCTEST_CONSTRUCTION_FROM_SUBTYPE
45 void WontCompile() { 45 void WontCompile() {
46 Callback<Parent()> cb_a; 46 Callback<Parent()> cb_a;
47 Callback<Child()> cb_b; 47 Callback<Child()> cb_b;
48 cb_a = cb_b; 48 cb_a = cb_b;
49 } 49 }
50 50
51 #endif 51 #endif
52 52
53 } // namespace base 53 } // namespace base
OLDNEW
« no previous file with comments | « base/callback_internal.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698