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

Unified Diff: Source/wtf/PassOwnArrayPtr.h

Issue 23531003: Type check when upcasting PassOwnPtr/PassOwnArrayPtr to avoid possible function call ambiguousness (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 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
Index: Source/wtf/PassOwnArrayPtr.h
diff --git a/Source/wtf/PassOwnArrayPtr.h b/Source/wtf/PassOwnArrayPtr.h
index 724dba3bf41e4a4dffd17e97d54560ac9a6d92d1..10cbce940becfd7f327197781021d0a7d56eef73 100644
--- a/Source/wtf/PassOwnArrayPtr.h
+++ b/Source/wtf/PassOwnArrayPtr.h
@@ -30,6 +30,11 @@
#include "wtf/NullPtr.h"
#include "wtf/TypeTraits.h"
+#define EnsureOwnArrayPtrConvertibleArgDefn \
+ typename EnableIf<IsPointerConvertible<U, T>::Value, bool>::Type
+#define EnsureOwnArrayPtrConvertibleArgDecl \
+ EnsureOwnArrayPtrConvertibleArgDefn = true
+
namespace WTF {
template<typename T> class OwnArrayPtr;
@@ -49,7 +54,7 @@ public:
// a const PassOwnArrayPtr. However, it makes it much easier to work with PassOwnArrayPtr
// temporaries, and we don't have a need to use real const PassOwnArrayPtrs anyway.
PassOwnArrayPtr(const PassOwnArrayPtr& o) : m_ptr(o.leakPtr()) { }
- template<typename U> PassOwnArrayPtr(const PassOwnArrayPtr<U>& o) : m_ptr(o.leakPtr()) { }
+ template<typename U> PassOwnArrayPtr(const PassOwnArrayPtr<U>& o, EnsureOwnArrayPtrConvertibleArgDecl) : m_ptr(o.leakPtr()) { }
~PassOwnArrayPtr() { deleteOwnedArrayPtr(m_ptr); }
« no previous file with comments | « Source/wtf/OwnPtrCommon.h ('k') | Source/wtf/PassOwnPtr.h » ('j') | Source/wtf/PassRefPtr.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698