[clang] [Clang][Sema] Fix -Whigher-precision-for-complex-division (PR #131477)
Mészáros Gergely via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 8 23:56:45 PDT 2025
================
@@ -10685,6 +10724,7 @@ QualType Sema::CheckMultiplyDivideOperands(ExprResult &LHS, ExprResult &RHS,
if (compType.isNull() || !compType->isArithmeticType())
return InvalidOperands(Loc, LHS, RHS);
if (IsDiv) {
+ DetectPrecisionLossInComplexDivision(*this, RHS.get()->getType(), Loc);
----------------
Maetveis wrote:
The dividend is not relevant assuming its a built-in arithmetic type, which I think it must be at this point in the code already. I'll try verifying this assumption though. Note that IIUC the types have "usual arithmetic conversions" applied to them here.
Whether the dividend is real or complex does not matter because complex divided by complex and real divided by complex both need promotion, but neither complex by complex (because it is elementwise) or real by real do.
https://github.com/llvm/llvm-project/pull/131477
More information about the cfe-commits
mailing list