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

Side by Side Diff: base/memory/scoped_ptr_unittest.nc

Issue 12040055: Fix no-compile tests in base. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « base/bind_unittest.nc ('k') | base/memory/weak_ptr_unittest.nc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 8
9 namespace { 9 namespace {
10 10
(...skipping 20 matching lines...) Expand all
31 void WontCompile() { 31 void WontCompile() {
32 scoped_ptr<RefCountedClass> x; 32 scoped_ptr<RefCountedClass> x;
33 } 33 }
34 34
35 #elif defined(NCTEST_NO_ARRAY_WITH_SIZE) // [r"size of array is negative"] 35 #elif defined(NCTEST_NO_ARRAY_WITH_SIZE) // [r"size of array is negative"]
36 36
37 void WontCompile() { 37 void WontCompile() {
38 scoped_ptr<int[10]> x; 38 scoped_ptr<int[10]> x;
39 } 39 }
40 40
41 #elif defined(NCTEST_NO_PASS_FROM_ARRAY) // [r"is private"] 41 #elif defined(NCTEST_NO_PASS_FROM_ARRAY) // [r"size of array is negative"]
42 42
43 void WontCompile() { 43 void WontCompile() {
44 scoped_ptr<int[]> a; 44 scoped_ptr<int[]> a;
45 scoped_ptr<int*> b; 45 scoped_ptr<int*> b;
46 b = a.Pass(); 46 b = a.Pass();
47 } 47 }
48 48
49 #elif defined(NCTEST_NO_PASS_TO_ARRAY) // [r"no match for 'operator='"] 49 #elif defined(NCTEST_NO_PASS_TO_ARRAY) // [r"no match for 'operator='"]
50 50
51 void WontCompile() { 51 void WontCompile() {
52 scoped_ptr<int*> a; 52 scoped_ptr<int*> a;
53 scoped_ptr<int[]> b; 53 scoped_ptr<int[]> b;
54 b = a.Pass(); 54 b = a.Pass();
55 } 55 }
56 56
57 #elif defined(NCTEST_NO_CONSTRUCT_FROM_ARRAY) // [r"is private"] 57 #elif defined(NCTEST_NO_CONSTRUCT_FROM_ARRAY) // [r"is private"]
58 58
59 void WontCompile() { 59 void WontCompile() {
60 scoped_ptr<int[]> a; 60 scoped_ptr<int[]> a;
61 scoped_ptr<int*> b(a.Pass()); 61 scoped_ptr<int*> b(a.Pass());
62 } 62 }
63 63
64 #elif defined(NCTEST_NO_CONSTRUCT_TO_ARRAY) // [r"no matching function for call '"] 64 #elif defined(NCTEST_NO_CONSTRUCT_TO_ARRAY) // [r"no matching function for call "]
65 65
66 void WontCompile() { 66 void WontCompile() {
67 scoped_ptr<int*> a; 67 scoped_ptr<int*> a;
68 scoped_ptr<int[]> b(a.Pass()); 68 scoped_ptr<int[]> b(a.Pass());
69 } 69 }
70 70
71 #elif defined(NCTEST_NO_DELETER_REFERENCE) // [r"fails to be a struct or class type'"] 71 #elif defined(NCTEST_NO_DELETER_REFERENCE) // [r"fails to be a struct or class type"]
72 72
73 struct Deleter { 73 struct Deleter {
74 void operator()(int*) {} 74 void operator()(int*) {}
75 }; 75 };
76 76
77 // Current implementation doesn't support Deleter Reference types. Enabling 77 // Current implementation doesn't support Deleter Reference types. Enabling
78 // support would require changes to the behavior of the constructors to match 78 // support would require changes to the behavior of the constructors to match
79 // including the use of SFINAE to discard the type-converting constructor 79 // including the use of SFINAE to discard the type-converting constructor
80 // as per C++11 20.7.1.2.1.19. 80 // as per C++11 20.7.1.2.1.19.
81 void WontCompile() { 81 void WontCompile() {
82 Deleter d; 82 Deleter d;
83 int n; 83 int n;
84 scoped_ptr<int*, Deleter&> a(&n, d); 84 scoped_ptr<int*, Deleter&> a(&n, d);
85 } 85 }
86 86
87 #endif 87 #endif
OLDNEW
« no previous file with comments | « base/bind_unittest.nc ('k') | base/memory/weak_ptr_unittest.nc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698