[clang] [clang][bytecode] Pass correct QualType to getFixedPointSemantics() (PR #196952)
via cfe-commits
cfe-commits at lists.llvm.org
Mon May 11 06:46:26 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
The expression type might be different, so pass the QualType we have at hand.
---
Full diff: https://github.com/llvm/llvm-project/pull/196952.diff
2 Files Affected:
- (modified) clang/lib/AST/ByteCode/Compiler.cpp (+1-1)
- (modified) clang/test/AST/ByteCode/fixed-point.cpp (+5)
``````````diff
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();
``````````
</details>
https://github.com/llvm/llvm-project/pull/196952
More information about the cfe-commits
mailing list