Bug 1214958 - Add operators &=, |=, and ^= to mozilla::DebugOnly. r=froydnj
authorL. David Baron <dbaron@dbaron.org>
Mon, 19 Oct 2015 20:42:28 -0700
changeset 303628 4d203aca24e3a471ab627fd5d919612ea9ab0e35
parent 303627 fa1abcf44453ef605a4e1b33cc5e99879a35af32
child 303629 4e1743f410b1ccd427ace5e24e829849b5786f92
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1214958
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1214958 - Add operators &=, |=, and ^= to mozilla::DebugOnly. r=froydnj
mfbt/DebugOnly.h
--- a/mfbt/DebugOnly.h
+++ b/mfbt/DebugOnly.h
@@ -46,18 +46,18 @@ public:
   DebugOnly& operator=(const T& aRhs) {
     value = aRhs;
     return *this;
   }
 
   void operator++(int) { value++; }
   void operator--(int) { value--; }
 
-  // Do not define operator+=() or operator-=() here.  These will coerce via
-  // the implicit cast and built-in operators.  Defining explicit methods here
+  // Do not define operator+=(), etc. here.  These will coerce via the
+  // implicit cast and built-in operators.  Defining explicit methods here
   // will create ambiguity the compiler can't deal with.
 
   T* operator&() { return &value; }
 
   operator T&() { return value; }
   operator const T&() const { return value; }
 
   T& operator->() { return value; }
@@ -67,16 +67,19 @@ public:
   DebugOnly() { }
   MOZ_IMPLICIT DebugOnly(const T&) { }
   DebugOnly(const DebugOnly&) { }
   DebugOnly& operator=(const T&) { return *this; }
   void operator++(int) { }
   void operator--(int) { }
   DebugOnly& operator+=(const T&) { return *this; }
   DebugOnly& operator-=(const T&) { return *this; }
+  DebugOnly& operator&=(const T&) { return *this; }
+  DebugOnly& operator|=(const T&) { return *this; }
+  DebugOnly& operator^=(const T&) { return *this; }
 #endif
 
   /*
    * DebugOnly must always have a destructor or else it will
    * generate "unused variable" warnings, exactly what it's intended
    * to avoid!
    */
   ~DebugOnly() {}