[clang] [clang][Interp] Implement IntegralAP::comp (PR #67954)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 2 01:27:55 PDT 2023
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/67954
>From 80bd890c332654458014c4acc20709b9cbb6eb90 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Sun, 1 Oct 2023 19:57:03 +0200
Subject: [PATCH] [clang][Interp] Implement IntegralAP::comp
---
clang/lib/AST/Interp/IntegralAP.h | 1 -
clang/test/AST/Interp/literals.cpp | 3 +++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/clang/lib/AST/Interp/IntegralAP.h b/clang/lib/AST/Interp/IntegralAP.h
index b2b367f30c238fe..b29aac2a73e3243 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