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

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: final fixups 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
« no previous file with comments | « Source/wtf/PartitionAlloc.cpp ('k') | Source/wtf/PassRefPtr.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/PassOwnPtr.h
diff --git a/Source/wtf/PassOwnPtr.h b/Source/wtf/PassOwnPtr.h
index 64dbc38dc06ba91410b5d54379c0282e39715dee..c35aefec67576049de781568f118d592caf6bf6e 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()));
}
« no previous file with comments | « Source/wtf/PartitionAlloc.cpp ('k') | Source/wtf/PassRefPtr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698