Fix DCHECKs in IOBufQueue
[folly.git] / folly / ThreadCachedInt.h
index 0627e8782206f8816945b1acc67cc72d28ee56b7..9b7c3136f117518e6e71fdfd88249880b9e9192b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -110,7 +110,10 @@ class ThreadCachedInt : boost::noncopyable {
   ThreadCachedInt& operator-=(IntT inc) { increment(-inc); return *this; }
   // pre-increment (we don't support post-increment)
   ThreadCachedInt& operator++() { increment(1); return *this; }
-  ThreadCachedInt& operator--() { increment(-1); return *this; }
+  ThreadCachedInt& operator--() {
+    increment(IntT(-1));
+    return *this;
+  }
 
   // Thread-safe set function.
   // This is a best effort implementation. In some edge cases, there could be
@@ -169,4 +172,4 @@ class ThreadCachedInt : boost::noncopyable {
   };
 };
 
-}
+} // namespace folly