[clang] [clang][bytecode] Pass correct QualType to getFixedPointSemantics() (PR #196952)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Mon May 11 06:45:38 PDT 2026
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/196952
The expression type might be different, so pass the QualType we have at hand.
>From 66e2ac5870c14bc3ca4faa6ed36540b1a57853fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Mon, 11 May 2026 15:37:31 +0200
Subject: [PATCH] [clang][bytecode] Pass correct QualType to
getFixedPointSemantics()
The expression type might be different, so pass the QualType we have at
hand.
---
clang/lib/AST/ByteCode/Compiler.cpp | 2 +-
clang/test/AST/ByteCode/fixed-point.cpp | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index bcdbd68731ee5..19bd927c672a3 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -4756,7 +4756,7 @@ bool Compiler<Emitter>::visitZeroInitializer(PrimType T, QualType QT,
return this->emitFloat(F, E);
}
case PT_FixedPoint: {
- auto Sem = Ctx.getASTContext().getFixedPointSemantics(E->getType());
+ auto Sem = Ctx.getASTContext().getFixedPointSemantics(QT);
return this->emitConstFixedPoint(FixedPoint::zero(Sem), E);
}
}
diff --git a/clang/test/AST/ByteCode/fixed-point.cpp b/clang/test/AST/ByteCode/fixed-point.cpp
index c8baa1972536a..f3b1f2e62929c 100644
--- a/clang/test/AST/ByteCode/fixed-point.cpp
+++ b/clang/test/AST/ByteCode/fixed-point.cpp
@@ -84,3 +84,8 @@ namespace Cmp {
static_assert(A < B);
static_assert(A <= B);
}
+
+struct S {
+ _Accum s[2];
+};
+S s = S();
More information about the cfe-commits
mailing list