From: Eric Christopher Date: Sun, 15 Jul 2012 00:24:00 +0000 (+0000) Subject: Use llvm::APSInt::isSameValue to compare for the same value. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2b884a873afac6b766dc7fff26a645b77b97dfcd;p=clang 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 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 +};