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

Unified Diff: base/memory/scoped_ptr_unittest.nc

Issue 1556683003: Fix no-compile base_unittests for base::Pass() -> std::move conversion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unneeded std::move Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/callback_list_unittest.nc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/scoped_ptr_unittest.nc
diff --git a/base/memory/scoped_ptr_unittest.nc b/base/memory/scoped_ptr_unittest.nc
index ebbfdb69a8dd091c615218cb0f98d189f1a9b724..329c97665ff3b954ede3ccf4b6fb88a89c046853 100644
--- a/base/memory/scoped_ptr_unittest.nc
+++ b/base/memory/scoped_ptr_unittest.nc
@@ -5,8 +5,11 @@
// This is a "No Compile Test" suite.
// http://dev.chromium.org/developers/testing/no-compile-tests
-#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
+
+#include <utility>
+
+#include "base/macros.h"
#include "base/memory/ref_counted.h"
namespace {
@@ -25,7 +28,7 @@ class RefCountedClass : public base::RefCountedThreadSafe<RefCountedClass> {
#if defined(NCTEST_NO_PASS_DOWNCAST) // [r"fatal error: no viable conversion from returned value of type 'scoped_ptr<\(anonymous namespace\)::Parent, default_delete<\(anonymous namespace\)::Parent>>' to function return type 'scoped_ptr<\(anonymous namespace\)::Child, default_delete<\(anonymous namespace\)::Child>>'"]
scoped_ptr<Child> DowncastUsingPassAs(scoped_ptr<Parent> object) {
- return object.Pass();
+ return object;
}
#elif defined(NCTEST_NO_REF_COUNTED_SCOPED_PTR) // [r"fatal error: static_assert failed \"T is a refcounted type and needs a scoped_refptr\""]
@@ -46,7 +49,7 @@ void WontCompile() {
void WontCompile() {
scoped_ptr<int[]> a;
scoped_ptr<int*> b;
- b = a.Pass();
+ b = std::move(a);
}
#elif defined(NCTEST_NO_PASS_TO_ARRAY) // [r"fatal error: no viable overloaded '='"]
@@ -54,21 +57,21 @@ void WontCompile() {
void WontCompile() {
scoped_ptr<int*> a;
scoped_ptr<int[]> b;
- b = a.Pass();
+ b = std::move(a);
}
#elif defined(NCTEST_NO_CONSTRUCT_FROM_ARRAY) // [r"fatal error: no matching constructor for initialization of 'scoped_ptr<int \*>'"]
void WontCompile() {
scoped_ptr<int[]> a;
- scoped_ptr<int*> b(a.Pass());
+ scoped_ptr<int*> b(std::move(a));
}
#elif defined(NCTEST_NO_CONSTRUCT_TO_ARRAY) // [r"fatal error: no matching constructor for initialization of 'scoped_ptr<int \[\]>'"]
void WontCompile() {
scoped_ptr<int*> a;
- scoped_ptr<int[]> b(a.Pass());
+ scoped_ptr<int[]> b(std::move(a));
}
#elif defined(NCTEST_NO_CONSTRUCT_SCOPED_PTR_ARRAY_FROM_NULL) // [r"is ambiguous"]
« no previous file with comments | « base/callback_list_unittest.nc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698