Use llvm::APSInt::isSameValue to compare for the same value.

Finishes rdar://11875995

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160225 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index cbf2368..11d8931 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -10435,7 +10435,7 @@
       continue;
     }
 
-    if (FirstVal != ECD->getInitVal())
+    if (!llvm::APSInt::isSameValue(FirstVal, ECD->getInitVal()))
       return;
   }
 
diff --git a/test/SemaCXX/warn-unique-enum.cpp b/test/SemaCXX/warn-unique-enum.cpp
index c9e40b0..59a1278 100644
--- a/test/SemaCXX/warn-unique-enum.cpp
+++ b/test/SemaCXX/warn-unique-enum.cpp
@@ -19,3 +19,9 @@
 enum I { I1 = H1, I2 = 4 };
 enum J { J1 = 4, J2 = I2 };
 enum K { K1, K2, K3, K4 };
+
+// Don't crash or warn on this one.
+// rdar://11875995
+enum L {
+  L1 = 0x8000000000000000ULL, L2 = 0x0000000000000001ULL
+};