[clang] [Clang] Fix crash when comparing fixed point type with BitInt (PR #199912)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 16 20:47:54 PDT 2026
https://github.com/superdusty updated https://github.com/llvm/llvm-project/pull/199912
>From 8b793c0202da13b640bb22a7b3fb3d0646690714 Mon Sep 17 00:00:00 2001
From: cry <2091136672 at foxmail.com>
Date: Thu, 28 May 2026 12:57:42 +0800
Subject: [PATCH 01/22] [Clang] Fix crash when comparing fixed point type with
BitInt
---
clang/docs/ReleaseNotes.rst | 1 +
clang/lib/Sema/SemaExpr.cpp | 5 ++++-
clang/test/Sema/fixed-point-bitint.c | 8 ++++++++
3 files changed, 13 insertions(+), 1 deletion(-)
create mode 100644 clang/test/Sema/fixed-point-bitint.c
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 6838cf3defcc1..f8c421824cb7b 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -559,6 +559,7 @@ Improvements to Coverage Mapping
Bug Fixes in This Version
-------------------------
+- Fixed a crash when comparing a fixed point type with a ``_BitInt`` type. (#GH196948)
- Fixed atomic boolean compound assignment; the conversion back to atomic bool would be miscompiled. (#GH33210)
- Correctly handle default template argument when establishing subsumption. (#GH188640)
- Fixed a failed assertion in the preprocessor when ``__has_embed`` parameters are missing parentheses. (#GH175088)
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 521a8516ac179..d88e34fcc43fc 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1287,6 +1287,10 @@ static QualType handleFloatConversion(Sema &S, ExprResult &LHS,
/// Helper function of UsualArithmeticConversions().
static bool unsupportedTypeConversion(const Sema &S, QualType LHSType,
QualType RHSType) {
+ if ((LHSType->isFixedPointType() && RHSType->isBitIntType()) ||
+ (LHSType->isBitIntType() && RHSType->isFixedPointType()))
+ return true;
+
// No issue if either is not a floating point type.
if (!LHSType->isFloatingType() || !RHSType->isFloatingType())
return false;
@@ -1533,7 +1537,6 @@ static QualType handleFixedPointConversion(Sema &S, QualType LHSTy,
RHSTy->isFixedPointOrIntegerType()) &&
"Special fixed point arithmetic operation conversions are only "
"applied to ints or other fixed point types");
-
// If one operand has signed fixed-point type and the other operand has
// unsigned fixed-point type, then the unsigned fixed-point operand is
// converted to its corresponding signed fixed-point type and the resulting
diff --git a/clang/test/Sema/fixed-point-bitint.c b/clang/test/Sema/fixed-point-bitint.c
new file mode 100644
index 0000000000000..d9ebf9fd61dbe
--- /dev/null
+++ b/clang/test/Sema/fixed-point-bitint.c
@@ -0,0 +1,8 @@
+// RUN: %%clang_cc1 -ffixed-point -fsyntax-only -verify %%s
+
+// Test that comparing fixed point type with BitInt doesn't crash
+// Fixes issue #196948
+
+constexpr _BitInt(128) i = 42;
+static_assert(i == 42.0k);
+// expected-error at -1 {{invalid operands to binary expression}}
>From 01d90659ecaf45aaad6758756c0a205135b3f4e3 Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Thu, 28 May 2026 13:35:27 +0800
Subject: [PATCH 02/22] Update fixed-point-bitint.c
---
clang/test/Sema/fixed-point-bitint.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/clang/test/Sema/fixed-point-bitint.c b/clang/test/Sema/fixed-point-bitint.c
index d9ebf9fd61dbe..78f7cb787d571 100644
--- a/clang/test/Sema/fixed-point-bitint.c
+++ b/clang/test/Sema/fixed-point-bitint.c
@@ -1,8 +1,5 @@
// RUN: %%clang_cc1 -ffixed-point -fsyntax-only -verify %%s
-// Test that comparing fixed point type with BitInt doesn't crash
-// Fixes issue #196948
-
constexpr _BitInt(128) i = 42;
static_assert(i == 42.0k);
// expected-error at -1 {{invalid operands to binary expression}}
>From 6410f56d63a0aad05e46592e046ea848ae5c89d0 Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Thu, 28 May 2026 13:38:16 +0800
Subject: [PATCH 03/22] Update ReleaseNotes.rst
---
clang/docs/ReleaseNotes.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index f8c421824cb7b..bf44a2a4e3d11 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -559,7 +559,7 @@ Improvements to Coverage Mapping
Bug Fixes in This Version
-------------------------
-- Fixed a crash when comparing a fixed point type with a ``_BitInt`` type. (#GH196948)
+- Fixed an assertion when comparing a fixed point type with a ``_BitInt`` type. (#GH196948)
- Fixed atomic boolean compound assignment; the conversion back to atomic bool would be miscompiled. (#GH33210)
- Correctly handle default template argument when establishing subsumption. (#GH188640)
- Fixed a failed assertion in the preprocessor when ``__has_embed`` parameters are missing parentheses. (#GH175088)
>From f1d0967f0b7a3f27749806ac1fadb3a20a26e534 Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Thu, 28 May 2026 13:42:13 +0800
Subject: [PATCH 04/22] Update SemaExpr.cpp
---
clang/lib/Sema/SemaExpr.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index d88e34fcc43fc..e6bad816d2d0a 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1285,6 +1285,9 @@ static QualType handleFloatConversion(Sema &S, ExprResult &LHS,
/// Diagnose attempts to convert between __float128, __ibm128 and
/// long double if there is no support for such conversion.
/// Helper function of UsualArithmeticConversions().
+/// Returns true if the conversion between LHSType and RHSType is not supported.
+/// This includes conversions between fixed point types and BitInt types,
+/// which would otherwise cause an assertion failure later.
static bool unsupportedTypeConversion(const Sema &S, QualType LHSType,
QualType RHSType) {
if ((LHSType->isFixedPointType() && RHSType->isBitIntType()) ||
>From b160488c1f5431e070c061d3674068e720af0d21 Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Thu, 28 May 2026 13:42:57 +0800
Subject: [PATCH 05/22] Update SemaExpr.cpp
---
clang/lib/Sema/SemaExpr.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index e6bad816d2d0a..aebb3a8bdc657 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1540,6 +1540,7 @@ static QualType handleFixedPointConversion(Sema &S, QualType LHSTy,
RHSTy->isFixedPointOrIntegerType()) &&
"Special fixed point arithmetic operation conversions are only "
"applied to ints or other fixed point types");
+
// If one operand has signed fixed-point type and the other operand has
// unsigned fixed-point type, then the unsigned fixed-point operand is
// converted to its corresponding signed fixed-point type and the resulting
>From c398595fb509bc4631b62a446e1e67a1e9a7dc5c Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Thu, 28 May 2026 15:55:54 +0800
Subject: [PATCH 06/22] Update SemaExpr.cpp
---
clang/lib/Sema/SemaExpr.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index aebb3a8bdc657..650976250ec61 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1540,7 +1540,7 @@ static QualType handleFixedPointConversion(Sema &S, QualType LHSTy,
RHSTy->isFixedPointOrIntegerType()) &&
"Special fixed point arithmetic operation conversions are only "
"applied to ints or other fixed point types");
-
+
// If one operand has signed fixed-point type and the other operand has
// unsigned fixed-point type, then the unsigned fixed-point operand is
// converted to its corresponding signed fixed-point type and the resulting
>From 5cc09e5bcf862cb66a36754d4fee5752574ca5a1 Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Thu, 28 May 2026 16:03:13 +0800
Subject: [PATCH 07/22] Update fixed-point-bitint.c
---
clang/test/Sema/fixed-point-bitint.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/clang/test/Sema/fixed-point-bitint.c b/clang/test/Sema/fixed-point-bitint.c
index 78f7cb787d571..d871ed06d8a02 100644
--- a/clang/test/Sema/fixed-point-bitint.c
+++ b/clang/test/Sema/fixed-point-bitint.c
@@ -1,5 +1,4 @@
// RUN: %%clang_cc1 -ffixed-point -fsyntax-only -verify %%s
-
+
constexpr _BitInt(128) i = 42;
-static_assert(i == 42.0k);
-// expected-error at -1 {{invalid operands to binary expression}}
+static_assert(i == 42.0k); // expected-error {{invalid operands to binary expression}}
>From e83b829d213a3e2c2378edef95dc126081045b30 Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Thu, 28 May 2026 16:08:30 +0800
Subject: [PATCH 08/22] Update SemaExpr.cpp
---
clang/lib/Sema/SemaExpr.cpp | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 650976250ec61..29d1824260444 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1282,12 +1282,10 @@ static QualType handleFloatConversion(Sema &S, ExprResult &LHS,
/*ConvertInt=*/!IsCompAssign);
}
-/// Diagnose attempts to convert between __float128, __ibm128 and
-/// long double if there is no support for such conversion.
-/// Helper function of UsualArithmeticConversions().
-/// Returns true if the conversion between LHSType and RHSType is not supported.
-/// This includes conversions between fixed point types and BitInt types,
-/// which would otherwise cause an assertion failure later.
+ /// Returns true if the conversion between LHSType and RHSType is not supported.
+ /// This includes conversions between fixed point types and BitInt types,
+ /// which would otherwise cause an assertion failure later.
+ /// Helper function of UsualArithmeticConversions().
static bool unsupportedTypeConversion(const Sema &S, QualType LHSType,
QualType RHSType) {
if ((LHSType->isFixedPointType() && RHSType->isBitIntType()) ||
>From 02ae899547a092e604a192dd2f70112d0da1c3c4 Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Thu, 28 May 2026 16:11:17 +0800
Subject: [PATCH 09/22] Update SemaExpr.cpp
---
clang/lib/Sema/SemaExpr.cpp | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 29d1824260444..ee7527b74c553 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1282,10 +1282,9 @@ static QualType handleFloatConversion(Sema &S, ExprResult &LHS,
/*ConvertInt=*/!IsCompAssign);
}
- /// Returns true if the conversion between LHSType and RHSType is not supported.
- /// This includes conversions between fixed point types and BitInt types,
- /// which would otherwise cause an assertion failure later.
- /// Helper function of UsualArithmeticConversions().
+/// Returns true if the conversion between LHSType and RHSType is not supported.
+/// This includes conversions between fixed point types and BitInt types.
+/// Helper function of UsualArithmeticConversions().
static bool unsupportedTypeConversion(const Sema &S, QualType LHSType,
QualType RHSType) {
if ((LHSType->isFixedPointType() && RHSType->isBitIntType()) ||
>From ae3068af670cdec936336c18aaddf5759538a120 Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Thu, 28 May 2026 21:14:43 +0800
Subject: [PATCH 10/22] Update SemaExpr.cpp
---
clang/lib/Sema/SemaExpr.cpp | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index ee7527b74c553..70a8b3e71062b 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1287,9 +1287,6 @@ static QualType handleFloatConversion(Sema &S, ExprResult &LHS,
/// Helper function of UsualArithmeticConversions().
static bool unsupportedTypeConversion(const Sema &S, QualType LHSType,
QualType RHSType) {
- if ((LHSType->isFixedPointType() && RHSType->isBitIntType()) ||
- (LHSType->isBitIntType() && RHSType->isFixedPointType()))
- return true;
// No issue if either is not a floating point type.
if (!LHSType->isFloatingType() || !RHSType->isFloatingType())
@@ -1755,7 +1752,11 @@ QualType Sema::UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS,
return Context.getCommonSugaredType(LHSType, RHSType);
// At this point, we have two different arithmetic types.
-
+
+ if ((LHSType->isFixedPointType() && RHSType->isBitIntType()) ||
+ (LHSType->isBitIntType() && RHSType->isFixedPointType()))
+ return QualType();
+
// Diagnose attempts to convert between __ibm128, __float128 and long double
// where such conversions currently can't be handled.
if (unsupportedTypeConversion(*this, LHSType, RHSType))
>From ed20f95bfb7bd110ea08d7646ff4119925e448db Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Thu, 28 May 2026 21:18:32 +0800
Subject: [PATCH 11/22] Update SemaExpr.cpp
---
clang/lib/Sema/SemaExpr.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 70a8b3e71062b..40ffc1ce5eee4 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1282,8 +1282,8 @@ static QualType handleFloatConversion(Sema &S, ExprResult &LHS,
/*ConvertInt=*/!IsCompAssign);
}
-/// Returns true if the conversion between LHSType and RHSType is not supported.
-/// This includes conversions between fixed point types and BitInt types.
+/// Diagnose attempts to convert between __float128, __ibm128 and
+/// long double if there is no support for such conversion.
/// Helper function of UsualArithmeticConversions().
static bool unsupportedTypeConversion(const Sema &S, QualType LHSType,
QualType RHSType) {
>From 9a1f4acc098cb88779ce3c19781e892afaca3d1c Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Thu, 28 May 2026 21:20:40 +0800
Subject: [PATCH 12/22] Update SemaExpr.cpp
---
clang/lib/Sema/SemaExpr.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 40ffc1ce5eee4..86ffc21d27c8c 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1752,7 +1752,7 @@ QualType Sema::UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS,
return Context.getCommonSugaredType(LHSType, RHSType);
// At this point, we have two different arithmetic types.
-
+
if ((LHSType->isFixedPointType() && RHSType->isBitIntType()) ||
(LHSType->isBitIntType() && RHSType->isFixedPointType()))
return QualType();
>From 22bf6fdb183040a43bab17672c9178d81b7f9b4a Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Thu, 28 May 2026 21:22:01 +0800
Subject: [PATCH 13/22] Update SemaExpr.cpp
---
clang/lib/Sema/SemaExpr.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 86ffc21d27c8c..a3159484d8ca9 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1287,7 +1287,6 @@ static QualType handleFloatConversion(Sema &S, ExprResult &LHS,
/// Helper function of UsualArithmeticConversions().
static bool unsupportedTypeConversion(const Sema &S, QualType LHSType,
QualType RHSType) {
-
// No issue if either is not a floating point type.
if (!LHSType->isFloatingType() || !RHSType->isFloatingType())
return false;
>From 15058e5a72d96e003030da5bea75689ed52d3a54 Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Sun, 31 May 2026 23:25:31 +0800
Subject: [PATCH 14/22] Delete clang/test/Sema/fixed-point-bitint.c
---
clang/test/Sema/fixed-point-bitint.c | 4 ----
1 file changed, 4 deletions(-)
delete mode 100644 clang/test/Sema/fixed-point-bitint.c
diff --git a/clang/test/Sema/fixed-point-bitint.c b/clang/test/Sema/fixed-point-bitint.c
deleted file mode 100644
index d871ed06d8a02..0000000000000
--- a/clang/test/Sema/fixed-point-bitint.c
+++ /dev/null
@@ -1,4 +0,0 @@
-// RUN: %%clang_cc1 -ffixed-point -fsyntax-only -verify %%s
-
-constexpr _BitInt(128) i = 42;
-static_assert(i == 42.0k); // expected-error {{invalid operands to binary expression}}
>From 11bdc37a479784468d03d1f785b5c0bde98b24f3 Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Sun, 31 May 2026 23:29:39 +0800
Subject: [PATCH 15/22] Update ext-int.cpp
---
clang/test/SemaCXX/ext-int.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/clang/test/SemaCXX/ext-int.cpp b/clang/test/SemaCXX/ext-int.cpp
index 281ae3d3c1779..9318f693e1cb2 100644
--- a/clang/test/SemaCXX/ext-int.cpp
+++ b/clang/test/SemaCXX/ext-int.cpp
@@ -316,3 +316,8 @@ void FromPaper1() {
void FromPaper2(_BitInt(8) a1, _BitInt(24) a2) {
static_assert(__is_same(decltype(a1 * (_BitInt(32))a2), _BitInt(32)), "");
}
+
+namespace GH196948{
+ constexpr _BitInt(128) i = 42;
+ static_assert(i == 42.0k);
+}
>From 2012e2be45189fb621de4f8b838da0ff4652f316 Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Sun, 31 May 2026 23:32:52 +0800
Subject: [PATCH 16/22] Update ext-int.cpp
---
clang/test/SemaCXX/ext-int.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/test/SemaCXX/ext-int.cpp b/clang/test/SemaCXX/ext-int.cpp
index 9318f693e1cb2..e6c6f7d80d994 100644
--- a/clang/test/SemaCXX/ext-int.cpp
+++ b/clang/test/SemaCXX/ext-int.cpp
@@ -319,5 +319,5 @@ void FromPaper2(_BitInt(8) a1, _BitInt(24) a2) {
namespace GH196948{
constexpr _BitInt(128) i = 42;
- static_assert(i == 42.0k);
+ static_assert(i == 42.0k);// expected-error {{invalid operands to binary expression}}
}
>From e26707cebb4adf3df5fd32fbb9bd65a076040717 Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Sun, 31 May 2026 23:36:15 +0800
Subject: [PATCH 17/22] Update ext-int.cpp
---
clang/test/SemaCXX/ext-int.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/test/SemaCXX/ext-int.cpp b/clang/test/SemaCXX/ext-int.cpp
index e6c6f7d80d994..8c0f5527d8267 100644
--- a/clang/test/SemaCXX/ext-int.cpp
+++ b/clang/test/SemaCXX/ext-int.cpp
@@ -319,5 +319,5 @@ void FromPaper2(_BitInt(8) a1, _BitInt(24) a2) {
namespace GH196948{
constexpr _BitInt(128) i = 42;
- static_assert(i == 42.0k);// expected-error {{invalid operands to binary expression}}
+ static_assert(i == 42.0k);// expected-error {{invalid operands to binary expression ('const _Bitint(128)' and '_Accum')}}
}
>From 52169b26c81636586ba27621c2982c2a2c8ea56d Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Sun, 31 May 2026 23:53:44 +0800
Subject: [PATCH 18/22] Update ext-int.cpp
---
clang/test/SemaCXX/ext-int.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/clang/test/SemaCXX/ext-int.cpp b/clang/test/SemaCXX/ext-int.cpp
index 8c0f5527d8267..3470b1aa75839 100644
--- a/clang/test/SemaCXX/ext-int.cpp
+++ b/clang/test/SemaCXX/ext-int.cpp
@@ -320,4 +320,5 @@ void FromPaper2(_BitInt(8) a1, _BitInt(24) a2) {
namespace GH196948{
constexpr _BitInt(128) i = 42;
static_assert(i == 42.0k);// expected-error {{invalid operands to binary expression ('const _Bitint(128)' and '_Accum')}}
+ // expected-warning {{'static_assert' with no message is a C++17 extension}}
}
>From 5bf05e42d07fcf9f4d3ea25882c4d7580c3ee1ae Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Sun, 31 May 2026 23:55:45 +0800
Subject: [PATCH 19/22] Update ext-int.cpp
---
clang/test/SemaCXX/ext-int.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/test/SemaCXX/ext-int.cpp b/clang/test/SemaCXX/ext-int.cpp
index 3470b1aa75839..b6cf82641254e 100644
--- a/clang/test/SemaCXX/ext-int.cpp
+++ b/clang/test/SemaCXX/ext-int.cpp
@@ -319,6 +319,6 @@ void FromPaper2(_BitInt(8) a1, _BitInt(24) a2) {
namespace GH196948{
constexpr _BitInt(128) i = 42;
- static_assert(i == 42.0k);// expected-error {{invalid operands to binary expression ('const _Bitint(128)' and '_Accum')}}
+ static_assert(i == 42.0k);// expected-error {{invalid operands to binary expression ('const _Bitint(128)' and '_Accum')}} \
// expected-warning {{'static_assert' with no message is a C++17 extension}}
}
>From 7957adc263182e6f4162bc724babc6cf94313e1b Mon Sep 17 00:00:00 2001
From: cry <2091136672 at foxmail.com>
Date: Wed, 10 Jun 2026 14:31:27 +0800
Subject: [PATCH 20/22] Fix expected-error case and remove expected-warning as
suggested
---
clang/test/SemaCXX/ext-int.cpp | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/clang/test/SemaCXX/ext-int.cpp b/clang/test/SemaCXX/ext-int.cpp
index b6cf82641254e..b2d0ac57e19ad 100644
--- a/clang/test/SemaCXX/ext-int.cpp
+++ b/clang/test/SemaCXX/ext-int.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -Wimplicit-int-conversion -Wno-unused -Wunevaluated-expression -triple aarch64-unknown-unknown
+// RUN: %clang_cc1 -fsyntax-only -ffixed-point -verify %s -Wimplicit-int-conversion -Wno-unused -Wunevaluated-expression -triple aarch64-unknown-unknown
template<int Bounds>
struct HasExtInt {
@@ -319,6 +319,5 @@ void FromPaper2(_BitInt(8) a1, _BitInt(24) a2) {
namespace GH196948{
constexpr _BitInt(128) i = 42;
- static_assert(i == 42.0k);// expected-error {{invalid operands to binary expression ('const _Bitint(128)' and '_Accum')}} \
- // expected-warning {{'static_assert' with no message is a C++17 extension}}
+ static_assert(i == 42.0k); // expected-error {{invalid operands to binary expression ('const _BitInt(128)' and '_Accum')}}
}
>From 69f56e6b63bbd7e3bfe58f7d399fe30091c183c4 Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Wed, 17 Jun 2026 11:31:36 +0800
Subject: [PATCH 21/22] Update SemaExpr.cpp
---
clang/lib/Sema/SemaExpr.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index a3159484d8ca9..50d1d49a880fb 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1755,7 +1755,7 @@ QualType Sema::UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS,
if ((LHSType->isFixedPointType() && RHSType->isBitIntType()) ||
(LHSType->isBitIntType() && RHSType->isFixedPointType()))
return QualType();
-
+
// Diagnose attempts to convert between __ibm128, __float128 and long double
// where such conversions currently can't be handled.
if (unsupportedTypeConversion(*this, LHSType, RHSType))
>From 6caed4c96c1ca5afa6aeab71baf09b1da4d37c5d Mon Sep 17 00:00:00 2001
From: superdusty <superdusty at foxmail.com>
Date: Wed, 17 Jun 2026 11:47:04 +0800
Subject: [PATCH 22/22] Update SemaExpr.cpp
More information about the cfe-commits
mailing list