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

Unified Diff: base/memory/weak_ptr_unittest.nc

Issue 2963623002: Make base::WeakPtr::Get() fast (Closed)
Patch Set: static_assert in the converting copy ctor and update no-compile test Created 3 years, 6 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
« base/memory/weak_ptr.cc ('K') | « base/memory/weak_ptr.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/weak_ptr_unittest.nc
diff --git a/base/memory/weak_ptr_unittest.nc b/base/memory/weak_ptr_unittest.nc
index 9b1226b7941da4117732b211dffe490e9caf9017..d86b0efe5156023129121a438052aaf31e8b6296 100644
--- a/base/memory/weak_ptr_unittest.nc
+++ b/base/memory/weak_ptr_unittest.nc
@@ -17,7 +17,7 @@ struct MultiplyDerivedProducer : Producer,
struct Unrelated {};
struct DerivedUnrelated : Unrelated {};
-#if defined(NCTEST_AUTO_DOWNCAST) // [r"fatal error: cannot initialize a member subobject of type 'base::DerivedProducer \*' with an lvalue of type 'base::Producer \*const'"]
+#if defined(NCTEST_AUTO_DOWNCAST) // [r'fatal error: static_assert failed "other must be a subclass of T"']
Nico 2017/06/28 14:36:56 The changes in this CL also feel like they could b
hans 2017/06/28 20:37:35 Yeah, this is part of the "move ptr_ into WeakPtrB
void WontCompile() {
Producer f;
@@ -25,7 +25,7 @@ void WontCompile() {
WeakPtr<DerivedProducer> derived_ptr = ptr;
}
-#elif defined(NCTEST_STATIC_DOWNCAST) // [r"fatal error: cannot initialize a member subobject of type 'base::DerivedProducer \*' with an lvalue of type 'base::Producer \*const'"]
+#elif defined(NCTEST_STATIC_DOWNCAST) // [r'fatal error: static_assert failed "other must be a subclass of T"']
void WontCompile() {
Producer f;
@@ -59,7 +59,7 @@ void WontCompile() {
SupportsWeakPtr<Producer>::StaticAsWeakPtr<DerivedProducer>(&f);
}
-#elif defined(NCTEST_UNSAFE_HELPER_DOWNCAST) // [r"fatal error: cannot initialize a member subobject of type 'base::DerivedProducer \*' with an lvalue of type 'base::Producer \*'"]
+#elif defined(NCTEST_UNSAFE_HELPER_DOWNCAST) // [r'fatal error: static_assert failed "other must be a subclass of T"']
void WontCompile() {
Producer f;
@@ -73,14 +73,14 @@ void WontCompile() {
WeakPtr<DerivedProducer> ptr = AsWeakPtr<DerivedProducer>(&f);
}
-#elif defined(NCTEST_UNSAFE_WRONG_INSANTIATED_HELPER_DOWNCAST) // [r"fatal error: cannot initialize a member subobject of type 'base::DerivedProducer \*' with an lvalue of type 'base::Producer \*'"]
+#elif defined(NCTEST_UNSAFE_WRONG_INSANTIATED_HELPER_DOWNCAST) // [r'fatal error: static_assert failed "other must be a subclass of T"']
void WontCompile() {
- Producer f;
+ Producer f;
WeakPtr<DerivedProducer> ptr = AsWeakPtr<Producer>(&f);
}
-#elif defined(NCTEST_UNSAFE_HELPER_CAST) // [r"fatal error: cannot initialize a member subobject of type 'base::OtherDerivedProducer \*' with an lvalue of type 'base::DerivedProducer \*'"]
+#elif defined(NCTEST_UNSAFE_HELPER_CAST) // [r'fatal error: static_assert failed "other must be a subclass of T"']
void WontCompile() {
DerivedProducer f;
@@ -94,14 +94,14 @@ void WontCompile() {
WeakPtr<OtherDerivedProducer> ptr = AsWeakPtr<OtherDerivedProducer>(&f);
}
-#elif defined(NCTEST_UNSAFE_WRONG_INSTANTIATED_HELPER_SIDECAST) // [r"fatal error: cannot initialize a member subobject of type 'base::OtherDerivedProducer \*' with an lvalue of type 'base::DerivedProducer \*'"]
+#elif defined(NCTEST_UNSAFE_WRONG_INSTANTIATED_HELPER_SIDECAST) // [r'fatal error: static_assert failed "other must be a subclass of T"']
void WontCompile() {
DerivedProducer f;
WeakPtr<OtherDerivedProducer> ptr = AsWeakPtr<DerivedProducer>(&f);
}
-#elif defined(NCTEST_UNRELATED_HELPER) // [r"fatal error: cannot initialize a member subobject of type 'base::Unrelated \*' with an lvalue of type 'base::DerivedProducer \*'"]
+#elif defined(NCTEST_UNRELATED_HELPER) // [r'fatal error: static_assert failed "other must be a subclass of T"']
void WontCompile() {
DerivedProducer f;
« base/memory/weak_ptr.cc ('K') | « base/memory/weak_ptr.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698