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

Unified Diff: Source/wtf/OwnPtr.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/OwnPtr.h
diff --git a/Source/wtf/OwnPtr.h b/Source/wtf/OwnPtr.h
index 2c3bc30b4cafae6d37bbd96448e407396b887ad5..301e61414c57dbe1fb9abe302ae84032283272db 100644
--- a/Source/wtf/OwnPtr.h
+++ b/Source/wtf/OwnPtr.h
@@ -89,10 +89,10 @@ namespace WTF {
private:
// 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 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 { 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 { 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 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; }
PtrType m_ptr;
};
@@ -105,7 +105,7 @@ namespace WTF {
template<typename T> template<typename U> inline OwnPtr<T>::OwnPtr(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 void OwnPtr<T>::clear()
@@ -131,7 +131,7 @@ namespace WTF {
template<typename T> inline typename OwnPtr<T>::ValueType& OwnPtr<T>::operator[](std::ptrdiff_t i) const
{
- COMPILE_ASSERT(IsArray<T>::value, Elements_access_is_possible_for_arrays_only);
+ static_assert(IsArray<T>::value, "Elements access is possible for arrays only");
ASSERT(m_ptr);
ASSERT(i >= 0);
return m_ptr[i];
@@ -148,7 +148,7 @@ namespace WTF {
template<typename T> template<typename U> inline OwnPtr<T>& OwnPtr<T>::operator=(const PassOwnPtr<U>& o)
{
- COMPILE_ASSERT(!IsArray<T>::value, Pointers_to_array_must_never_be_converted);
+ static_assert(!IsArray<T>::value, "Pointers to array must never be converted");
PtrType ptr = m_ptr;
m_ptr = o.leakPtr();
ASSERT(!ptr || m_ptr != ptr);
@@ -164,7 +164,7 @@ namespace WTF {
template<typename T> template<typename U> inline OwnPtr<T>::OwnPtr(OwnPtr<U>&& o)
: 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 OwnPtr<T>& OwnPtr<T>::operator=(OwnPtr<T>&& o)
@@ -179,7 +179,7 @@ namespace WTF {
template<typename T> template<typename U> inline OwnPtr<T>& OwnPtr<T>::operator=(OwnPtr<U>&& o)
{
- COMPILE_ASSERT(!IsArray<T>::value, Pointers_to_array_must_never_be_converted);
+ static_assert(!IsArray<T>::value, "Pointers to array must never be converted");
PtrType ptr = m_ptr;
m_ptr = o.leakPtr();
ASSERT(!ptr || m_ptr != ptr);

Powered by Google App Engine
This is Rietveld 408576698