Fix PointerIntPair so that it can use an enum class as its integer template argument.
[oota-llvm.git] / include / llvm / ADT / PointerIntPair.h
index 0058d85d1ae406745b48b6c644c9cc4af7394702..83fbf127e6dac1d709e3f55934363a0d91425a39 100644 (file)
@@ -55,20 +55,25 @@ public:
 
   PointerTy getPointer() const { return Info::getPointer(Value); }
 
-  IntType getInt() const { return (IntType)Info::getInt(Value); }
+  IntType getInt() const {
+    return (IntType)Info::getInt(Value);
+  }
 
   void setPointer(PointerTy PtrVal) {
     Value = Info::updatePointer(Value, PtrVal);
   }
 
-  void setInt(IntType IntVal) { Value = Info::updateInt(Value, IntVal); }
+  void setInt(IntType IntVal) {
+    Value = Info::updateInt(Value, static_cast<intptr_t>(IntVal));
+  }
 
   void initWithPointer(PointerTy PtrVal) {
     Value = Info::updatePointer(0, PtrVal);
   }
 
   void setPointerAndInt(PointerTy PtrVal, IntType IntVal) {
-    Value = Info::updateInt(Info::updatePointer(0, PtrVal), IntVal);
+    Value = Info::updateInt(Info::updatePointer(0, PtrVal),
+                            static_cast<intptr_t>(IntVal));
   }
 
   PointerTy const *getAddrOfPointer() const {