From 95c76a6863f0e86e244c47d4089604164eb83d0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Sat, 28 Mar 2020 13:57:18 +0000 Subject: [PATCH] Bug 1625138 - Part 28: Replace mozilla::AddRvalueReference with std::add_rvalue_reference. r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D68546 --HG-- extra : moz-landing-system : lando --- mfbt/TypeTraits.h | 39 ----------------------------------- mfbt/tests/TestTypeTraits.cpp | 15 -------------- 2 files changed, 54 deletions(-) diff --git a/mfbt/TypeTraits.h b/mfbt/TypeTraits.h index 69e103e5917e..7b07ed504b5e 100644 --- a/mfbt/TypeTraits.h +++ b/mfbt/TypeTraits.h @@ -219,45 +219,6 @@ struct RemoveCV { typedef typename RemoveConst::Type>::Type Type; }; -/* 20.9.7.2 Reference modifications [meta.trans.ref] */ - -namespace detail { - -enum Voidness { TIsVoid, TIsNotVoid }; - -template ::value ? TIsVoid : TIsNotVoid> -struct AddRvalueReferenceHelper; - -template -struct AddRvalueReferenceHelper { - typedef void Type; -}; - -template -struct AddRvalueReferenceHelper { - typedef T&& Type; -}; - -} // namespace detail - -/** - * AddRvalueReference adds an rvalue && reference to T if one isn't already - * present. (Note: adding an rvalue reference to an lvalue & reference in - * essence keeps the &, per C+11 reference collapsing rules. For example, - * int& would remain int&.) - * - * The final computed type will only *not* be a reference if T is void. - * - * mozilla::AddRvalueReference::Type is int&&; - * mozilla::AddRvalueRference::Type is volatile int&; - * mozilla::AddRvalueRference::Type is const int&&; - * mozilla::AddRvalueReference::Type is void*&&; - * mozilla::AddRvalueReference::Type is void; - * mozilla::AddRvalueReference::Type is struct S&. - */ -template -struct AddRvalueReference : detail::AddRvalueReferenceHelper {}; - } /* namespace mozilla */ #endif /* mozilla_TypeTraits_h */ diff --git a/mfbt/tests/TestTypeTraits.cpp b/mfbt/tests/TestTypeTraits.cpp index e86062f6e857..9e811a6a05c5 100644 --- a/mfbt/tests/TestTypeTraits.cpp +++ b/mfbt/tests/TestTypeTraits.cpp @@ -7,7 +7,6 @@ #include "mozilla/Assertions.h" #include "mozilla/TypeTraits.h" -using mozilla::AddRvalueReference; using mozilla::IsDestructible; using mozilla::IsSame; @@ -28,20 +27,6 @@ static_assert(!IsDestructible::value, static_assert(IsDestructible::value, "trivial destructible class is destructible"); -static_assert(IsSame::Type, int&&>::value, - "not adding && to int correctly"); -static_assert( - IsSame::Type, volatile int&>::value, - "not adding && to volatile int& correctly"); -static_assert(IsSame::Type, const int&&>::value, - "not adding && to volatile int& correctly"); -static_assert(IsSame::Type, void*&&>::value, - "not adding && to void* correctly"); -static_assert(IsSame::Type, void>::value, - "void shouldn't be transformed by AddRvalueReference"); -static_assert(IsSame::Type, struct S1&>::value, - "not reference-collapsing struct S1& && to struct S1& correctly"); - /* * Android's broken [u]intptr_t inttype macros are broken because its PRI*PTR * macros are defined as "ld", but sizeof(long) is 8 and sizeof(intptr_t)