diff --git a/mfbt/EnumSet.h b/mfbt/EnumSet.h index ae4364034e266..f635ec51ffbf9 100644 --- a/mfbt/EnumSet.h +++ b/mfbt/EnumSet.h @@ -50,8 +50,16 @@ class EnumSet { } } +#ifdef DEBUG constexpr EnumSet(const EnumSet& aEnumSet) : mBitField(aEnumSet.mBitField) {} + constexpr EnumSet& operator=(const EnumSet& aEnumSet) { + mBitField = aEnumSet.mBitField; + incVersion(); + return *this; + } +#endif + /** * Add an element */ diff --git a/mfbt/tests/TestEnumSet.cpp b/mfbt/tests/TestEnumSet.cpp index d330f0d4ef6eb..035c1fcfee9ac 100644 --- a/mfbt/tests/TestEnumSet.cpp +++ b/mfbt/tests/TestEnumSet.cpp @@ -7,6 +7,8 @@ #include "mozilla/EnumSet.h" #include "mozilla/Vector.h" +#include + using namespace mozilla; enum SeaBird { @@ -78,6 +80,8 @@ class EnumSetSuite { "EnumSet should be no bigger than the enum by default"); static_assert(sizeof(EnumSet) == sizeof(uint32_t), "EnumSet should be able to have its size overriden."); + static_assert(std::is_trivially_copyable_v>, + "EnumSet should be lightweight outside of debug."); #endif }