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

Unified Diff: Source/wtf/PassOwnPtr.h

Issue 802203004: replace COMPILE_ASSERT with static assert in wtf/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: search/replace fixup Created 6 years 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/PassOwnPtr.h
diff --git a/Source/wtf/PassOwnPtr.h b/Source/wtf/PassOwnPtr.h
index 64dbc38dc06ba91410b5d54379c0282e39715dee..f01b73bb8e0dba9e50d5d0335dd1adea54ef9796 100644
--- a/Source/wtf/PassOwnPtr.h
+++ b/Source/wtf/PassOwnPtr.h
@@ -73,14 +73,14 @@ namespace WTF {
private:
explicit PassOwnPtr(PtrType ptr) : m_ptr(ptr) { }
- PassOwnPtr& operator=(const PassOwnPtr&) { COMPILE_ASSERT(!sizeof(T*), PassOwnPtr_should_never_be_assigned_to); return *this; }
+ PassOwnPtr& operator=(const PassOwnPtr&) { static_assert(!sizeof(T*), "PassOwnPtr should never be assigned to"); return *this; }
// We should never have two OwnPtrs for the same underlying object (otherwise we'll get
// double-destruction), so these equality operators should never be needed.
- template<typename U> bool operator==(const PassOwnPtr<U>&) const { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
- template<typename U> bool operator!=(const PassOwnPtr<U>&) const { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
- template<typename U> bool operator==(const OwnPtr<U>&) const { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
- template<typename U> bool operator!=(const OwnPtr<U>&) const { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
+ template<typename U> bool operator==(const PassOwnPtr<U>&) const { static_assert(!sizeof(U*), "OwnPtrs should never be equal"); return false; }
+ template<typename U> bool operator!=(const PassOwnPtr<U>&) const { static_assert(!sizeof(U*), "OwnPtrs should never be equal"); return false; }
+ template<typename U> bool operator==(const OwnPtr<U>&) const { static_assert(!sizeof(U*), "OwnPtrs should never be equal"); return false; }
+ template<typename U> bool operator!=(const OwnPtr<U>&) const { static_assert(!sizeof(U*), "OwnPtrs should never be equal"); return false; }
mutable PtrType m_ptr;
};
@@ -88,7 +88,7 @@ namespace WTF {
template<typename T> template<typename U> inline PassOwnPtr<T>::PassOwnPtr(const PassOwnPtr<U>& o, EnsurePtrConvertibleArgDefn(U, T))
: m_ptr(o.leakPtr())
{
- COMPILE_ASSERT(!IsArray<T>::value, Pointers_to_array_must_never_be_converted);
+ static_assert(!IsArray<T>::value, "Pointers to array must never be converted");
}
template<typename T> inline typename PassOwnPtr<T>::PtrType PassOwnPtr<T>::leakPtr() const
@@ -130,7 +130,7 @@ namespace WTF {
template<typename T, typename U> inline PassOwnPtr<T> static_pointer_cast(const PassOwnPtr<U>& p)
{
- COMPILE_ASSERT(!IsArray<T>::value, Pointers_to_array_must_never_be_converted);
+ static_assert(!IsArray<T>::value, "Pointers to array must never be converted");
return adoptPtr(static_cast<T*>(p.leakPtr()));
}

Powered by Google App Engine
This is Rietveld 408576698