[clang] 2d4de5a - [clang][Interp] Implement IntegralAP::comp (#67954)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 2 08:41:17 PDT 2023
Author: Timm Baeder
Date: 2023-10-02T17:41:14+02:00
New Revision: 2d4de5acfa2a1f84d5566acd1ecc122d309c11c8
URL: https://github.com/llvm/llvm-project/commit/2d4de5acfa2a1f84d5566acd1ecc122d309c11c8
DIFF: https://github.com/llvm/llvm-project/commit/2d4de5acfa2a1f84d5566acd1ecc122d309c11c8.diff
LOG: [clang][Interp] Implement IntegralAP::comp (#67954)
Added:
Modified:
clang/lib/AST/Interp/IntegralAP.h
clang/test/AST/Interp/literals.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/IntegralAP.h b/clang/lib/AST/Interp/IntegralAP.h
index a9e34a5b237a195..42f44354cbd2599 100644
--- a/clang/lib/AST/Interp/IntegralAP.h
+++ b/clang/lib/AST/Interp/IntegralAP.h
@@ -210,7 +210,6 @@ template <bool Signed> class IntegralAP final {
}
static bool comp(IntegralAP A, IntegralAP *R) {
- assert(false);
*R = IntegralAP(~A.V);
return false;
}
diff --git a/clang/test/AST/Interp/literals.cpp b/clang/test/AST/Interp/literals.cpp
index eca0e4c2cbd26f1..00182ba4ab1d918 100644
--- a/clang/test/AST/Interp/literals.cpp
+++ b/clang/test/AST/Interp/literals.cpp
@@ -52,6 +52,9 @@ namespace i128 {
constexpr int128_t Two = (int128_t)1 << 1ul;
static_assert(Two == 2, "");
+ constexpr uint128_t AllOnes = ~static_cast<uint128_t>(0);
+ static_assert(AllOnes == static_cast<uint128_t>(-1), "");
+
#if __cplusplus >= 201402L
template <typename T>
constexpr T CastFrom(__int128_t A) {
More information about the cfe-commits
mailing list