aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2012-07-15 00:24:00 +0000
committerEric Christopher <echristo@apple.com>2012-07-15 00:24:00 +0000
commit2b884a873afac6b766dc7fff26a645b77b97dfcd (patch)
tree09e71049ae36732eecc26f0e2d6a9c89d856ecab
parent81695fa3a4772a62131eca45f8582cff72b1b9db (diff)
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
-rw-r--r--lib/Sema/SemaDecl.cpp2
-rw-r--r--test/SemaCXX/warn-unique-enum.cpp6
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index cbf2368f71..11d8931320 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -10435,7 +10435,7 @@ static void CheckForUniqueEnumValues(Sema &S, Decl **Elements,
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 c9e40b0014..59a1278071 100644
--- a/test/SemaCXX/warn-unique-enum.cpp
+++ b/test/SemaCXX/warn-unique-enum.cpp
@@ -19,3 +19,9 @@ enum H { H1 = 4, H_MAX = H1, H_MIN = H1 };
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
+};